def __init__(self, stat_timer_name, **kwargs):
        self.dimensions = kwargs

        self._meteorite_timer = yelp_meteorite.create_timer(
            stat_timer_name,
            self.dimensions
        )
Exemple #2
0
def create_timer(name, dimensions={}):
    if not METRICS_ENABLED:
        return

    if name not in _registered_metrics:
        timer = yelp_meteorite.create_timer(
            name, default_dimensions=dimensions)
        _registered_metrics[name] = timer
def _create_or_fake_timer(*args, **kwargs):
    """Create a Timer metric if yelp_meteorite is loaded (passing args), otherwise return a fake
    :return: Timer metric object
    """
    try:
        return create_timer(*args, **kwargs)
    except NameError:
        return FakeMetric()
Exemple #4
0
 def create_timer(self, name: str, **kwargs: Any) -> TimerProtocol:
     return yelp_meteorite.create_timer(self.base_name + "." + name, kwargs)
Exemple #5
0
 def create_timer(name: str, *args: Any, **kwargs: Any) -> TimerProtocol:
     return yelp_meteorite.create_timer(name, *args, **kwargs)
Exemple #6
0
 def create_timer(self, name, **kwargs):
     return yelp_meteorite.create_timer('paasta.deployd.{}'.format(name),
                                        kwargs)
Exemple #7
0
 def get_timer_emitter(self, metric, default_dimensions=None):
     return yelp_meteorite.create_timer(
         metric,
         default_dimensions
     )
Exemple #8
0
    def __init__(self, stat_timer_name, **kwargs):
        self.dimensions = kwargs

        self._meteorite_timer = yelp_meteorite.create_timer(
            stat_timer_name, self.dimensions)