Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
sbrunner committed Jun 7, 2023
1 parent d00ba56 commit c6b51f0
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions c2cwsgiutils/scripts/stats_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,11 @@ def get_gauge(self, kind: str, kind_help: str, labels: List[str]) -> Gauge:
return self.gauges[kind]

def do_report(
self, metric: List[str], value: int, kind: str, kind_help: str, tags: Optional[Dict[str, str]] = None
self, metric: List[str], value: int, kind: str, kind_help: str, tags: Dict[str, str]
) -> None:
LOG.debug("%s.%s -> %d", kind, ".".join(metric), value)
if value > 0: # Don't export 0 values. We can always set null=0 in grafana...
tags = {**(tags or {}), **stats.get_env_tags()}
gauge = self.get_gauge(kind, kind_help, list(tags.keys()))
gauge.labels(**tags).set(value)
gauge = self.get_gauge(kind, kind_help, list(tags.keys()))
gauge.labels(**tags).set(value)

def commit(self) -> None:
if self.prometheus_push:
Expand Down

0 comments on commit c6b51f0

Please sign in to comment.