Skip to content
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

don't override existing labels in scrape jobs #593

Merged
merged 2 commits into from
Apr 25, 2024
Merged

Conversation

lucabello
Copy link
Contributor

Issue

Closes #571.

Solution

Changing the order of the dictionaries to unpack makes sure that pre-exising labels have priority over the automatically-generated topology.

Testing Instructions

Modify a charm (e.g., blackbox) to specify a custom juju_application label; then relate it to two Prometheus instances (one without the fix, the other with the fix) and check the difference in the targets section.

Before:
Screenshot_20240424_100749

After:
Screenshot_20240424_100923


There is a unit test that explicitly checks that we do overwrite the topology labels (and it's aptly called test_consumer_overwrites_juju_topology_labels, in the file tests/unit/test_endpoint_consumer.py). I'm removing that test, since it doesn't really make sense with this PR :)

I would like another pair of eyes to confirm this PR is something we want to do!

Copy link
Contributor

@Abuelodelanada Abuelodelanada left a comment

Choose a reason for hiding this comment

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

LGTM!

@lucabello lucabello merged commit 84a537e into main Apr 25, 2024
13 checks passed
@lucabello lucabello deleted the fix/labels-override branch April 25, 2024 06:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Topology labels are overridden in MetricsEndpointProvider
3 participants