From 9835571f9b397a781fde9ddc9038decc7246d1a3 Mon Sep 17 00:00:00 2001 From: Vijay Samuel Date: Tue, 2 Apr 2019 03:38:09 -0700 Subject: [PATCH] Add _bucket to histogram metrics in Prometheus Collector (#11578) * Add _bucket to histogram metrics --- CHANGELOG.next.asciidoc | 2 ++ metricbeat/module/prometheus/collector/collector_test.go | 2 +- metricbeat/module/prometheus/collector/data.go | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.next.asciidoc b/CHANGELOG.next.asciidoc index 912318d348a..a765a4bfa20 100644 --- a/CHANGELOG.next.asciidoc +++ b/CHANGELOG.next.asciidoc @@ -65,6 +65,8 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d *Metricbeat* +- Add _bucket to histogram metrics in Prometheus Collector {pull}11578[11578] + *Packetbeat* - Prevent duplicate packet loss error messages in HTTP events. {pull}10709[10709] diff --git a/metricbeat/module/prometheus/collector/collector_test.go b/metricbeat/module/prometheus/collector/collector_test.go index 362ae0a137b..f87ecfe5846 100644 --- a/metricbeat/module/prometheus/collector/collector_test.go +++ b/metricbeat/module/prometheus/collector/collector_test.go @@ -155,7 +155,7 @@ func TestGetPromEventsFromMetricFamily(t *testing.T) { }, { data: common.MapStr{ - "http_request_duration_microseconds": uint64(10), + "http_request_duration_microseconds_bucket": uint64(10), }, labels: common.MapStr{"le": "0.99"}, }, diff --git a/metricbeat/module/prometheus/collector/data.go b/metricbeat/module/prometheus/collector/data.go index 0120aa55db3..a2e191d3309 100644 --- a/metricbeat/module/prometheus/collector/data.go +++ b/metricbeat/module/prometheus/collector/data.go @@ -115,7 +115,7 @@ func getPromEventsFromMetricFamily(mf *dto.MetricFamily) []PromEvent { events = append(events, PromEvent{ data: common.MapStr{ - name: bucket.GetCumulativeCount(), + name + "_bucket": bucket.GetCumulativeCount(), }, labels: bucketLabels, })