Skip to content

[receiver/simpleprometheus] Pass labels configuration to Prometheus properly #40723

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 16, 2025

Conversation

crobert-1
Copy link
Member

@crobert-1 crobert-1 commented Jun 13, 2025

Description

Provides fix as described in the issue. The original issue was the the receiver was not properly configuring the Prometheus receiver, which this is a wrapper for. This change is to simply pass the labels under the Labels Prometheus receiver option, rather than under Target.

Link to tracking issue

Fixes #40722

Testing

Manually tested on CLI. There aren't good tests for this component, shown by this bug not being caught earlier. If anyone has any ideas for good ways to add tests here, I'd be happy to add them.

@@ -112,7 +112,6 @@ func getPrometheusConfig(cfg *Config) (*prometheusreceiver.Config, error) {
for k, v := range cfg.Labels {
labels[model.LabelName(k)] = model.LabelValue(v)
}
labels[model.AddressLabel] = model.LabelValue(cfg.Endpoint)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This label is added to Targets as it was before, we're just directly setting it now.

@atoulme atoulme merged commit b8ced7b into open-telemetry:main Jun 16, 2025
178 checks passed
@github-actions github-actions bot added this to the next release milestone Jun 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[receiver/simpleprometheus] Labels are being added incorrectly in configuration
4 participants