diff --git a/sheetsync/setup.py b/sheetsync/setup.py index 32933cc..5627eb7 100644 --- a/sheetsync/setup.py +++ b/sheetsync/setup.py @@ -7,7 +7,7 @@ setup( install_requires = [ "argh", "gevent", - "prometheus-client", + "prometheus-client==0.7.1", # locked version as we rely on internals "psycogreen", "psycopg2", "python-dateutil", diff --git a/sheetsync/sheetsync/main.py b/sheetsync/sheetsync/main.py index 0466ac1..a85595c 100644 --- a/sheetsync/sheetsync/main.py +++ b/sheetsync/sheetsync/main.py @@ -201,6 +201,9 @@ class SheetSync(object): for row in result.fetchall(): by_id[row.id] = row counts[row.sheet_name, row.category, str(row.poster_moment), row.state, str(bool(row.error))] += 1 + # Reach into metric internals and forget about all previous values, + # or else any values we don't update will remain as a stale count. + event_counts._metrics.clear() for labels, count in counts.items(): event_counts.labels(*labels).set(count) return by_id