def __init__(self, stat_counter_name, message_count_timer=0.25, **kwargs):
        self.dimensions = kwargs

        self.message_count_timer = message_count_timer
        self._meteorite_counter = yelp_meteorite.create_counter(
            stat_counter_name,
            self.dimensions
        )
        self._reset()
示例#2
0
def report_metric_to_meteorite(backend, metric, value, paasta_cluster):
    try:
        paasta_service, paasta_instance = parse_haproxy_backend_name(backend)
    except IndexError:
        return

    meteorite_dims = {
        "paasta_service": paasta_service,
        "paasta_cluster": paasta_cluster,
        "paasta_instance": paasta_instance,
    }
    path = f"paasta.service.requests.{metric}"
    if metric in GUAGES:
        guage = yelp_meteorite.create_gauge(path, meteorite_dims)
        guage.set(value)
    elif metric in COUNTERS:
        counter = yelp_meteorite.create_counter(path, meteorite_dims)
        counter.count(value)
    else:
        raise ValueError(
            f"{metric} hasn't been configured as a guage or counter")
    print(f"Sent {path}: {value} to meteorite")
示例#3
0
 def create_counter(self, name: str, **kwargs: Any) -> CounterProtocol:
     return yelp_meteorite.create_counter(self.base_name + "." + name,
                                          kwargs)
示例#4
0
 def create_counter(name: str, *args: Any, **kwargs: Any) -> CounterProtocol:
     return yelp_meteorite.create_counter(name, *args, **kwargs)
示例#5
0
 def get_counter_emitter(self, metric, default_dimensions=None):
     return yelp_meteorite.create_counter(
         metric,
         default_dimensions
     )