From 42c90a791e2a3e67e0881fae4c0e9b33202767db Mon Sep 17 00:00:00 2001 From: Balint Zsilavecz Date: Wed, 19 Oct 2022 10:30:43 +0100 Subject: [PATCH 1/5] Patch prometheus client to fix `+Inf` histogram bucket handling --- go.mod | 2 +- go.sum | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/go.mod b/go.mod index 0d6e083c97a56..49089dbcf0b0f 100644 --- a/go.mod +++ b/go.mod @@ -510,7 +510,7 @@ require ( github.com/pmezard/go-difflib v1.0.0 // indirect github.com/power-devops/perfstat v0.0.0-20220216144756-c35f1ee13d7c // indirect github.com/pquerna/cachecontrol v0.1.0 // indirect - github.com/prometheus/client_golang v1.13.0 // indirect + github.com/prometheus/client_golang v1.13.1-0.20221013115219-dcea97eee2b3 // indirect github.com/prometheus/client_model v0.2.0 // indirect github.com/prometheus/common v0.37.0 // indirect github.com/prometheus/common/sigv4 v0.1.0 // indirect diff --git a/go.sum b/go.sum index 742c687e613c4..0207d9351cee7 100644 --- a/go.sum +++ b/go.sum @@ -1710,8 +1710,9 @@ github.com/prometheus/client_golang v1.11.0/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqr github.com/prometheus/client_golang v1.11.1/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0= github.com/prometheus/client_golang v1.12.1/go.mod h1:3Z9XVyYiZYEO+YQWt3RD2R3jrbd179Rt297l4aS6nDY= github.com/prometheus/client_golang v1.12.2/go.mod h1:3Z9XVyYiZYEO+YQWt3RD2R3jrbd179Rt297l4aS6nDY= -github.com/prometheus/client_golang v1.13.0 h1:b71QUfeo5M8gq2+evJdTPfZhYMAU0uKPkyPJ7TPsloU= github.com/prometheus/client_golang v1.13.0/go.mod h1:vTeo+zgvILHsnnj/39Ou/1fPN5nJFOEMgftOUOmlvYQ= +github.com/prometheus/client_golang v1.13.1-0.20221013115219-dcea97eee2b3 h1:T49ADLrYOgiyTHKx/N7tUxcglkLEt7xzDoQRqJNTzKg= +github.com/prometheus/client_golang v1.13.1-0.20221013115219-dcea97eee2b3/go.mod h1:vTeo+zgvILHsnnj/39Ou/1fPN5nJFOEMgftOUOmlvYQ= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190115171406-56726106282f/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= From 2c8c41d2e5b94ca8eab8eb511240eda90bf199e0 Mon Sep 17 00:00:00 2001 From: Balint Zsilavecz Date: Wed, 19 Oct 2022 14:14:17 +0100 Subject: [PATCH 2/5] Fix `+Inf` bucket count for prometheus remote write --- pkg/translator/prometheusremotewrite/helper.go | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/pkg/translator/prometheusremotewrite/helper.go b/pkg/translator/prometheusremotewrite/helper.go index 709385bc9cd1f..09446331b80f1 100644 --- a/pkg/translator/prometheusremotewrite/helper.go +++ b/pkg/translator/prometheusremotewrite/helper.go @@ -344,10 +344,7 @@ func addSingleHistogramDataPoint(pt pmetric.HistogramDataPoint, resource pcommon if pt.Flags().NoRecordedValue() { infBucket.Value = math.Float64frombits(value.StaleNaN) } else { - if pt.BucketCounts().Len() > 0 { - cumulativeCount += pt.BucketCounts().At(pt.BucketCounts().Len() - 1) - } - infBucket.Value = float64(cumulativeCount) + infBucket.Value = float64(pt.Count()) } infLabels := createAttributes(resource, pt.Attributes(), settings.ExternalLabels, nameStr, baseName+bucketStr, leStr, pInfStr) sig := addSample(tsMap, infBucket, infLabels, metric.Type().String()) From a6c6af2f4270c29e06132082c386029484371d5d Mon Sep 17 00:00:00 2001 From: Balint Zsilavecz Date: Wed, 19 Oct 2022 14:22:50 +0100 Subject: [PATCH 3/5] Add changelog --- .chloggen/prometheus-fix-inf-bucket-count.yaml | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100755 .chloggen/prometheus-fix-inf-bucket-count.yaml diff --git a/.chloggen/prometheus-fix-inf-bucket-count.yaml b/.chloggen/prometheus-fix-inf-bucket-count.yaml new file mode 100755 index 0000000000000..a0515a204fb79 --- /dev/null +++ b/.chloggen/prometheus-fix-inf-bucket-count.yaml @@ -0,0 +1,11 @@ +# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' +change_type: bug_fix + +# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver) +component: prometheusremotewriteexporter + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: Fix value of `+Inf` histogram bucket to be equal to total count + +# One or more tracking issues related to the change +issues: [4975] From b026c51e13b72a211b3418b0b59ebb7020bc226c Mon Sep 17 00:00:00 2001 From: Balint Zsilavecz Date: Wed, 19 Oct 2022 14:53:29 +0100 Subject: [PATCH 4/5] Go tidy --- cmd/configschema/go.mod | 2 +- cmd/configschema/go.sum | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/cmd/configschema/go.mod b/cmd/configschema/go.mod index c7c5678cc1fa7..813090fed5b81 100644 --- a/cmd/configschema/go.mod +++ b/cmd/configschema/go.mod @@ -510,7 +510,7 @@ require ( github.com/pmezard/go-difflib v1.0.0 // indirect github.com/power-devops/perfstat v0.0.0-20220216144756-c35f1ee13d7c // indirect github.com/pquerna/cachecontrol v0.1.0 // indirect - github.com/prometheus/client_golang v1.13.0 // indirect + github.com/prometheus/client_golang v1.13.1-0.20221013115219-dcea97eee2b3 // indirect github.com/prometheus/client_model v0.2.0 // indirect github.com/prometheus/common v0.37.0 // indirect github.com/prometheus/common/sigv4 v0.1.0 // indirect diff --git a/cmd/configschema/go.sum b/cmd/configschema/go.sum index 2fce85692aaf0..0e9474e48efd9 100644 --- a/cmd/configschema/go.sum +++ b/cmd/configschema/go.sum @@ -1713,8 +1713,9 @@ github.com/prometheus/client_golang v1.11.0/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqr github.com/prometheus/client_golang v1.11.1/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0= github.com/prometheus/client_golang v1.12.1/go.mod h1:3Z9XVyYiZYEO+YQWt3RD2R3jrbd179Rt297l4aS6nDY= github.com/prometheus/client_golang v1.12.2/go.mod h1:3Z9XVyYiZYEO+YQWt3RD2R3jrbd179Rt297l4aS6nDY= -github.com/prometheus/client_golang v1.13.0 h1:b71QUfeo5M8gq2+evJdTPfZhYMAU0uKPkyPJ7TPsloU= github.com/prometheus/client_golang v1.13.0/go.mod h1:vTeo+zgvILHsnnj/39Ou/1fPN5nJFOEMgftOUOmlvYQ= +github.com/prometheus/client_golang v1.13.1-0.20221013115219-dcea97eee2b3 h1:T49ADLrYOgiyTHKx/N7tUxcglkLEt7xzDoQRqJNTzKg= +github.com/prometheus/client_golang v1.13.1-0.20221013115219-dcea97eee2b3/go.mod h1:vTeo+zgvILHsnnj/39Ou/1fPN5nJFOEMgftOUOmlvYQ= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190115171406-56726106282f/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= From 67dc7e2a0d142e6faf1c4562f4f1cccb4cee645b Mon Sep 17 00:00:00 2001 From: Balint Zsilavecz Date: Wed, 19 Oct 2022 15:19:39 +0100 Subject: [PATCH 5/5] Update prometheus/client_golang version for prometheusexporter directly --- exporter/prometheusexporter/go.mod | 2 +- exporter/prometheusexporter/go.sum | 4 ++-- processor/spanmetricsprocessor/go.mod | 2 +- processor/spanmetricsprocessor/go.sum | 4 ++-- testbed/go.mod | 2 +- testbed/go.sum | 3 ++- 6 files changed, 9 insertions(+), 8 deletions(-) diff --git a/exporter/prometheusexporter/go.mod b/exporter/prometheusexporter/go.mod index 6ae906150c696..a0886c8e5191d 100644 --- a/exporter/prometheusexporter/go.mod +++ b/exporter/prometheusexporter/go.mod @@ -7,7 +7,7 @@ require ( github.com/open-telemetry/opentelemetry-collector-contrib/pkg/resourcetotelemetry v0.62.0 github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/prometheus v0.62.0 github.com/open-telemetry/opentelemetry-collector-contrib/receiver/prometheusreceiver v0.62.0 - github.com/prometheus/client_golang v1.13.0 + github.com/prometheus/client_golang v1.13.1-0.20221013115219-dcea97eee2b3 github.com/prometheus/client_model v0.2.0 github.com/prometheus/common v0.37.0 github.com/prometheus/prometheus v0.38.0 diff --git a/exporter/prometheusexporter/go.sum b/exporter/prometheusexporter/go.sum index a4ba92566ffbf..7200409ba5efe 100644 --- a/exporter/prometheusexporter/go.sum +++ b/exporter/prometheusexporter/go.sum @@ -519,8 +519,8 @@ github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP github.com/prometheus/client_golang v1.11.0/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0= github.com/prometheus/client_golang v1.11.1/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0= github.com/prometheus/client_golang v1.12.1/go.mod h1:3Z9XVyYiZYEO+YQWt3RD2R3jrbd179Rt297l4aS6nDY= -github.com/prometheus/client_golang v1.13.0 h1:b71QUfeo5M8gq2+evJdTPfZhYMAU0uKPkyPJ7TPsloU= -github.com/prometheus/client_golang v1.13.0/go.mod h1:vTeo+zgvILHsnnj/39Ou/1fPN5nJFOEMgftOUOmlvYQ= +github.com/prometheus/client_golang v1.13.1-0.20221013115219-dcea97eee2b3 h1:T49ADLrYOgiyTHKx/N7tUxcglkLEt7xzDoQRqJNTzKg= +github.com/prometheus/client_golang v1.13.1-0.20221013115219-dcea97eee2b3/go.mod h1:vTeo+zgvILHsnnj/39Ou/1fPN5nJFOEMgftOUOmlvYQ= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= diff --git a/processor/spanmetricsprocessor/go.mod b/processor/spanmetricsprocessor/go.mod index 914a5f936b935..50e19ce8b29a6 100644 --- a/processor/spanmetricsprocessor/go.mod +++ b/processor/spanmetricsprocessor/go.mod @@ -58,7 +58,7 @@ require ( github.com/pelletier/go-toml v1.9.5 // indirect github.com/pelletier/go-toml/v2 v2.0.5 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - github.com/prometheus/client_golang v1.13.0 // indirect + github.com/prometheus/client_golang v1.13.1-0.20221013115219-dcea97eee2b3 // indirect github.com/prometheus/client_model v0.2.0 // indirect github.com/prometheus/common v0.37.0 // indirect github.com/prometheus/procfs v0.8.0 // indirect diff --git a/processor/spanmetricsprocessor/go.sum b/processor/spanmetricsprocessor/go.sum index 58542a5a1070f..733d045327cbc 100644 --- a/processor/spanmetricsprocessor/go.sum +++ b/processor/spanmetricsprocessor/go.sum @@ -371,8 +371,8 @@ github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP github.com/prometheus/client_golang v1.11.0/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0= github.com/prometheus/client_golang v1.11.1/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0= github.com/prometheus/client_golang v1.12.1/go.mod h1:3Z9XVyYiZYEO+YQWt3RD2R3jrbd179Rt297l4aS6nDY= -github.com/prometheus/client_golang v1.13.0 h1:b71QUfeo5M8gq2+evJdTPfZhYMAU0uKPkyPJ7TPsloU= -github.com/prometheus/client_golang v1.13.0/go.mod h1:vTeo+zgvILHsnnj/39Ou/1fPN5nJFOEMgftOUOmlvYQ= +github.com/prometheus/client_golang v1.13.1-0.20221013115219-dcea97eee2b3 h1:T49ADLrYOgiyTHKx/N7tUxcglkLEt7xzDoQRqJNTzKg= +github.com/prometheus/client_golang v1.13.1-0.20221013115219-dcea97eee2b3/go.mod h1:vTeo+zgvILHsnnj/39Ou/1fPN5nJFOEMgftOUOmlvYQ= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= diff --git a/testbed/go.mod b/testbed/go.mod index fa6b6dd4e30b5..718b161401359 100644 --- a/testbed/go.mod +++ b/testbed/go.mod @@ -165,7 +165,7 @@ require ( github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c // indirect - github.com/prometheus/client_golang v1.13.0 // indirect + github.com/prometheus/client_golang v1.13.1-0.20221013115219-dcea97eee2b3 // indirect github.com/prometheus/client_model v0.2.0 // indirect github.com/prometheus/common/sigv4 v0.1.0 // indirect github.com/prometheus/procfs v0.8.0 // indirect diff --git a/testbed/go.sum b/testbed/go.sum index 60e7e83163691..a886d544e4db2 100644 --- a/testbed/go.sum +++ b/testbed/go.sum @@ -1115,8 +1115,9 @@ github.com/prometheus/client_golang v1.11.0/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqr github.com/prometheus/client_golang v1.11.1/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0= github.com/prometheus/client_golang v1.12.1/go.mod h1:3Z9XVyYiZYEO+YQWt3RD2R3jrbd179Rt297l4aS6nDY= github.com/prometheus/client_golang v1.12.2/go.mod h1:3Z9XVyYiZYEO+YQWt3RD2R3jrbd179Rt297l4aS6nDY= -github.com/prometheus/client_golang v1.13.0 h1:b71QUfeo5M8gq2+evJdTPfZhYMAU0uKPkyPJ7TPsloU= github.com/prometheus/client_golang v1.13.0/go.mod h1:vTeo+zgvILHsnnj/39Ou/1fPN5nJFOEMgftOUOmlvYQ= +github.com/prometheus/client_golang v1.13.1-0.20221013115219-dcea97eee2b3 h1:T49ADLrYOgiyTHKx/N7tUxcglkLEt7xzDoQRqJNTzKg= +github.com/prometheus/client_golang v1.13.1-0.20221013115219-dcea97eee2b3/go.mod h1:vTeo+zgvILHsnnj/39Ou/1fPN5nJFOEMgftOUOmlvYQ= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190115171406-56726106282f/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=