Skip to content

Commit

Permalink
Periods aren't valid in metric names, so replace with underscores
Browse files Browse the repository at this point in the history
Metric names generated from ES results may have periods in them (e.g. the
percentiles aggregation). This solution also silently replaces periods in
user-selected parts of metric names, but that's not a disastrous
side-effect for a much simpler implementation.

There will be other characters that are invalid in metric names, but lets
ignore them unless we find a ES query that generates them.
  • Loading branch information
Braedon Vickers committed Sep 1, 2016
1 parent 19b856a commit 5a168e9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions prometheus_es_exporter/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
gauges = {}

def format_label_value(value_list):
return '_'.join(value_list)
return '_'.join(value_list).replace('.', '_')

def format_metric_name(name_list):
return '_'.join(name_list)
return '_'.join(name_list).replace('.', '_')

def update_gauges(metrics):
metric_dict = {}
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

setup(
name='prometheus-es-exporter',
version='0.1.1',
version='0.1.2',
description='Elasticsearch query Prometheus exporter',
url='https://github.com/Braedon/prometheus-es-exporter',
author='Braedon Vickers',
Expand Down

0 comments on commit 5a168e9

Please sign in to comment.