Skip to content

Commit

Permalink
Fix debug log for increment metric
Browse files Browse the repository at this point in the history
  • Loading branch information
vokracko authored and danihodovic committed Jan 14, 2024
1 parent 78654a9 commit dcf86f5
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/exporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,14 +279,15 @@ def track_task_event(self, event):

if counter_name == event["type"]:
counter.labels(**_labels).inc()
logger.debug(
"Incremented metric='{}' labels='{}'", counter._name, labels
)
elif (
event["type"] != "task-sent"
): # task-sent is sent by various hosts (webservers, task creators etc.) which cause label cardinality # pylint: disable=line-too-long
# increase unaffected counters by zero in order to make them visible
counter.labels(**_labels).inc(0)

logger.debug("Incremented metric='{}' labels='{}'", counter._name, labels)

# observe task runtime
if event["type"] == "task-succeeded":
self.celery_task_runtime.labels(**labels).observe(task.runtime)
Expand Down

0 comments on commit dcf86f5

Please sign in to comment.