Skip to content

Commit

Permalink
Fix path to graphs in statsd (#3159)
Browse files Browse the repository at this point in the history
Fix path to graphs in statsd
  • Loading branch information
ar4s committed Sep 5, 2017
1 parent a0bcc73 commit 2cff557
Showing 1 changed file with 2 additions and 4 deletions.
Expand Up @@ -10,8 +10,6 @@
from ralph.lib.metrics import build_statsd_client

logger = logging.getLogger(__name__)
PREFIX = settings.STATSD_GRAPHS_PREFIX
STATSD_PATH = '{}.{{}}.{{}}'.format(PREFIX)


def normalize(s):
Expand All @@ -24,11 +22,11 @@ class Command(BaseCommand):
help = textwrap.dedent(__doc__).strip()

def handle(self, *args, **kwargs):
statsd = build_statsd_client(prefix=STATSD_PATH)
statsd = build_statsd_client(prefix=settings.STATSD_GRAPHS_PREFIX)
graphs = Graph.objects.filter(push_to_statsd=True)
for graph in graphs:
graph_data = graph.get_data()
graph_name = normalize(graph.name)
for label, value in zip(graph_data['labels'], graph_data['series']):
path = STATSD_PATH.format(graph_name, normalize(label))
path = '.'.join((graph_name, normalize(label)))
statsd.gauge(path, value)

0 comments on commit 2cff557

Please sign in to comment.