From 5a168e9e2c43bb90452a6e77a3d5d11f3e86ca54 Mon Sep 17 00:00:00 2001 From: Braedon Vickers Date: Thu, 1 Sep 2016 13:33:24 +1200 Subject: [PATCH] Periods aren't valid in metric names, so replace with underscores 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. --- prometheus_es_exporter/__init__.py | 4 ++-- setup.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/prometheus_es_exporter/__init__.py b/prometheus_es_exporter/__init__.py index c470fef..a8bcbe1 100644 --- a/prometheus_es_exporter/__init__.py +++ b/prometheus_es_exporter/__init__.py @@ -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 = {} diff --git a/setup.py b/setup.py index 2b51abe..a747656 100644 --- a/setup.py +++ b/setup.py @@ -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',