Skip to content

Commit

Permalink
fix: additional graphite reference
Browse files Browse the repository at this point in the history
  • Loading branch information
rickymoorhouse committed Apr 11, 2024
1 parent 1ab3e2e commit 7403a97
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions trawler.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,12 +123,13 @@ def set_gauge(self, component, target_name, value, pod_name=None, labels=None):
self.gauges[prometheus_target].set(value)
except ValueError as value_exception:
self.logger.exception(value_exception)
if self.config['graphite']['enabled']:
if pod_name:
metric_name = "{}.{}.{}".format(component, pod_name, target_name)
else:
metric_name = "{}.{}".format(component, target_name)
self.graphite.stage(metric_name, value)
if 'graphite' in self.config:
if self.config['graphite']['enabled']:
if pod_name:
metric_name = "{}.{}.{}".format(component, pod_name, target_name)
else:
metric_name = "{}.{}".format(component, target_name)
self.graphite.stage(metric_name, value)

def inc_counter(self, component, target_name, value, pod_name=None, labels=None):
""" Set or increase prometheus counter """
Expand Down

0 comments on commit 7403a97

Please sign in to comment.