sheetsync: Clear event counts before each update

Otherwise, no count of 0 ever gets set, and things are left showing
values when they shouldn't.
pull/155/head
Mike Lang 5 years ago
parent 47c8ebf11f
commit ab157afe20

@ -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",

@ -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

Loading…
Cancel
Save