From 929ba0a6378f6b584b4bdad577f29863111c2452 Mon Sep 17 00:00:00 2001 From: Daniel Nelson Date: Wed, 21 Jun 2017 12:36:29 -0700 Subject: [PATCH] Remove label value sanitization in prometheus output (#2939) --- plugins/outputs/prometheus_client/prometheus_client.go | 2 +- plugins/outputs/prometheus_client/prometheus_client_test.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/outputs/prometheus_client/prometheus_client.go b/plugins/outputs/prometheus_client/prometheus_client.go index 137bf3095..b52dcff6d 100644 --- a/plugins/outputs/prometheus_client/prometheus_client.go +++ b/plugins/outputs/prometheus_client/prometheus_client.go @@ -205,7 +205,7 @@ func (p *PrometheusClient) Write(metrics []telegraf.Metric) error { labels := make(map[string]string) for k, v := range tags { - labels[sanitize(k)] = sanitize(v) + labels[sanitize(k)] = v } for fn, fv := range point.Fields() { diff --git a/plugins/outputs/prometheus_client/prometheus_client_test.go b/plugins/outputs/prometheus_client/prometheus_client_test.go index 3ce211beb..85b6dde5c 100644 --- a/plugins/outputs/prometheus_client/prometheus_client_test.go +++ b/plugins/outputs/prometheus_client/prometheus_client_test.go @@ -144,7 +144,7 @@ func TestWrite_Sanitize(t *testing.T) { require.True(t, ok) require.Equal(t, map[string]string{ - "tag_with_dash": "localhost_local"}, sample1.Labels) + "tag_with_dash": "localhost.local"}, sample1.Labels) } func TestWrite_Gauge(t *testing.T) {