Skip to content

Commit

Permalink
Prometheus Receiver: Unregister self-observability metrics on Shutdown (
Browse files Browse the repository at this point in the history
#32202)

**Description:**

Prometheus libraries will currently fail to initialize if they are
called more than once for the same component name. This is because it
attempts to register the same self-observability metrics, which isn't
allowed by the Prometheus client. To work around this, Unregister all
self-observability metrics during Shutdown.

This updates the prometheus dependency to an unreleased version to pull
in prometheus/prometheus#13897 and
prometheus/prometheus#13896.

**Link to tracking Issue:** <Issue number if applicable>

Fixes
#32123

**Testing:**

Unit test added.

**Documentation:**

N/A

cc @cpheps @djaglowski
  • Loading branch information
dashpole authored Apr 5, 2024
1 parent d198445 commit 191c2c9
Show file tree
Hide file tree
Showing 37 changed files with 276 additions and 231 deletions.
27 changes: 27 additions & 0 deletions .chloggen/prometheus-receiver-unregister.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Use this changelog template to create an entry for release notes.

# 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: prometheusreceiver

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Fix a bug where a new prometheus receiver with the same name cannot be created after the previous receiver is Shutdown

# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
issues: [32123]

# (Optional) One or more lines of additional information to render under the primary note.
# These lines will be padded with 2 spaces and then inserted directly into the document.
# Use pipe (|) for multiline entries.
subtext:

# If your change doesn't affect end users or the exported elements of any package,
# you should instead start your pull request title with [chore] or use the "Skip Changelog" label.
# Optional: The change log or logs in which this entry should be included.
# e.g. '[user]' or '[user, api]'
# Include 'user' if the change is relevant to end users.
# Include 'api' if there is a change to a library API.
# Default: '[user]'
change_logs: []
4 changes: 2 additions & 2 deletions cmd/configschema/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ require (
github.com/lib/pq v1.10.9 // indirect
github.com/lightstep/go-expohisto v1.0.0 // indirect
github.com/linkedin/goavro/v2 v2.9.8 // indirect
github.com/linode/linodego v1.29.0 // indirect
github.com/linode/linodego v1.30.0 // indirect
github.com/logicmonitor/lm-data-sdk-go v1.3.0 // indirect
github.com/lufia/plan9stats v0.0.0-20220913051719-115f729f3c8c // indirect
github.com/magiconair/properties v1.8.7 // indirect
Expand Down Expand Up @@ -565,7 +565,7 @@ require (
github.com/prometheus/common v0.51.1 // indirect
github.com/prometheus/common/sigv4 v0.1.0 // indirect
github.com/prometheus/procfs v0.13.0 // indirect
github.com/prometheus/prometheus v0.51.1 // indirect
github.com/prometheus/prometheus v0.51.2-0.20240405174432-b4a973753c6e // indirect
github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect
github.com/redis/go-redis/v9 v9.5.1 // indirect
github.com/relvacode/iso8601 v1.4.0 // indirect
Expand Down
12 changes: 6 additions & 6 deletions cmd/configschema/go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions cmd/otelcontribcol/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ require (
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/windowsperfcountersreceiver v0.97.0
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/zipkinreceiver v0.97.0
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/zookeeperreceiver v0.97.0
github.com/prometheus/prometheus v0.51.1
github.com/prometheus/prometheus v0.51.2-0.20240405174432-b4a973753c6e
github.com/stretchr/testify v1.9.0
go.opentelemetry.io/collector/component v0.97.1-0.20240404121116-4f1a8936d26b
go.opentelemetry.io/collector/config/configgrpc v0.97.1-0.20240404121116-4f1a8936d26b
Expand Down Expand Up @@ -499,7 +499,7 @@ require (
github.com/lib/pq v1.10.9 // indirect
github.com/lightstep/go-expohisto v1.0.0 // indirect
github.com/linkedin/goavro/v2 v2.9.8 // indirect
github.com/linode/linodego v1.29.0 // indirect
github.com/linode/linodego v1.30.0 // indirect
github.com/logicmonitor/lm-data-sdk-go v1.3.0 // indirect
github.com/lufia/plan9stats v0.0.0-20220913051719-115f729f3c8c // indirect
github.com/magiconair/properties v1.8.7 // indirect
Expand Down
12 changes: 6 additions & 6 deletions cmd/otelcontribcol/go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions cmd/oteltestbedcol/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ require (
github.com/kolo/xmlrpc v0.0.0-20220921171641-a4b6fa1dd06b // indirect
github.com/kylelemons/godebug v1.1.0 // indirect
github.com/leodido/ragel-machinery v0.0.0-20181214104525-299bdde78165 // indirect
github.com/linode/linodego v1.29.0 // indirect
github.com/linode/linodego v1.30.0 // indirect
github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
Expand Down Expand Up @@ -198,7 +198,7 @@ require (
github.com/prometheus/common v0.51.1 // indirect
github.com/prometheus/common/sigv4 v0.1.0 // indirect
github.com/prometheus/procfs v0.12.0 // indirect
github.com/prometheus/prometheus v0.51.1 // indirect
github.com/prometheus/prometheus v0.51.2-0.20240405174432-b4a973753c6e // indirect
github.com/rs/cors v1.10.1 // indirect
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.25 // indirect
github.com/shirou/gopsutil/v3 v3.24.3 // indirect
Expand Down Expand Up @@ -283,9 +283,9 @@ require (
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/api v0.29.2 // indirect
k8s.io/apimachinery v0.29.2 // indirect
k8s.io/client-go v0.29.2 // indirect
k8s.io/api v0.29.3 // indirect
k8s.io/apimachinery v0.29.3 // indirect
k8s.io/client-go v0.29.3 // indirect
k8s.io/klog/v2 v2.120.1 // indirect
k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00 // indirect
k8s.io/utils v0.0.0-20230726121419-3b25d923346b // indirect
Expand Down
24 changes: 12 additions & 12 deletions cmd/oteltestbedcol/go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions connector/datadogconnector/go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions exporter/datadogexporter/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ require (
github.com/kylelemons/godebug v1.1.0 // indirect
github.com/leodido/ragel-machinery v0.0.0-20181214104525-299bdde78165 // indirect
github.com/leoluk/perflib_exporter v0.2.1 // indirect
github.com/linode/linodego v1.29.0 // indirect
github.com/linode/linodego v1.30.0 // indirect
github.com/lufia/plan9stats v0.0.0-20220913051719-115f729f3c8c // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
Expand Down Expand Up @@ -219,7 +219,7 @@ require (
github.com/prometheus/common v0.51.1 // indirect
github.com/prometheus/common/sigv4 v0.1.0 // indirect
github.com/prometheus/procfs v0.13.0 // indirect
github.com/prometheus/prometheus v0.51.1 // indirect
github.com/prometheus/prometheus v0.51.2-0.20240405174432-b4a973753c6e // indirect
github.com/rs/cors v1.10.1 // indirect
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.25 // indirect
github.com/secure-systems-lab/go-securesystemslib v0.7.0 // indirect
Expand Down
Loading

0 comments on commit 191c2c9

Please sign in to comment.