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

prometheusreceiver: Don't ignore instance labels for internal metrics #14555

Conversation

rmfitzpatrick
Copy link
Contributor

@rmfitzpatrick rmfitzpatrick commented Sep 27, 2022

Description:
Fixing a bug - In federated endpoint scraping cases internal labels are required to differentiate scraped metrics and receiver-internal ones. These changes take the metric name into consideration when establishing "not useful" labels for metric group identity.

Link to tracking Issue:
#14453

Testing:
ongoing - I'm having issues w/ my dev environment and running these tests reliably.
Added basic unit tests for internal metric attributes.

@dashpole
Copy link
Contributor

When we are scraping federated metrics, wouldn't we always want to take job + instance labels into account, not just for internal metrics?

@rmfitzpatrick
Copy link
Contributor Author

rmfitzpatrick commented Sep 28, 2022

When we are scraping federated metrics, wouldn't we always want to take job + instance labels into account, not just for internal metrics?

I believe the prometheus server target info is already preserved and made available in the resource of the scraped federated metrics. For example when I have a federated server scrape a collector's metric endpoint and* another collector scrape that federated endpoint I see:

http.scheme: http
net.host.name: target-collector
net.host.port: "8888"
service.instance.id: target-collector:8888
service.name: collector

@dashpole
Copy link
Contributor

If I scrape a federated endpoint, and it has two metrics which are identical except for job + instance (non-internal metrics), they would collide and experience this issue, right? It seems fairly safe to ~always take job + instance into account.

@dashpole
Copy link
Contributor

IIUC, the issue isn't that we aren't preserving job + instance (it is in the resource, as you show), but that these two metrics end up "colliding":

foo{"job": bar, "instance: "0.0.0.0:8888"}
foo{}

Right?

@rmfitzpatrick
Copy link
Contributor Author

rmfitzpatrick commented Sep 28, 2022

IIUC, the issue isn't that we aren't preserving job + instance (it is in the resource, as you show), but that these two metrics end up "colliding"< ... >
Right?

I think that's correct and am not sure why job and instance were deemed not useful. My proposed change was a minimal way to address clear collisions w/ federated scraping* but can see the value in not filtering them in any case.

@github-actions
Copy link
Contributor

This PR was marked stale due to lack of activity. It will be closed in 14 days.

@github-actions github-actions bot added the Stale label Oct 13, 2022
@rmfitzpatrick rmfitzpatrick force-pushed the prom_federated_internal_metrics branch from 9633a80 to 4a6154a Compare October 31, 2022 19:36
@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Oct 31, 2022

CLA Signed

The committers listed above are authorized under a signed CLA.

  • ✅ login: rmfitzpatrick / name: Ryan Fitzpatrick (26536bbc9f3d4bda581f4162ba8217dec4bab31c)

@rmfitzpatrick rmfitzpatrick force-pushed the prom_federated_internal_metrics branch from 4a6154a to 26536bb Compare October 31, 2022 19:41
@github-actions github-actions bot removed the Stale label Nov 9, 2022
@rmfitzpatrick rmfitzpatrick force-pushed the prom_federated_internal_metrics branch 2 times, most recently from 0ac375d to c4e52cd Compare November 9, 2022 20:28
@rmfitzpatrick rmfitzpatrick force-pushed the prom_federated_internal_metrics branch from c4e52cd to 6f7f501 Compare November 9, 2022 21:28
@rmfitzpatrick rmfitzpatrick marked this pull request as ready for review November 9, 2022 21:33
@dashpole
Copy link
Contributor

My proposed change was a minimal way to address clear collisions w/ federated scraping* but can see the value in not filtering them in any case.

I would prefer not filtering them in any cases here.

@github-actions
Copy link
Contributor

This PR was marked stale due to lack of activity. It will be closed in 14 days.

@github-actions github-actions bot added the Stale label Nov 27, 2022
@dashpole dashpole added bug Something isn't working receiver/prometheus Prometheus receiver and removed Stale labels Nov 28, 2022
@fatsheep9146
Copy link
Contributor

any update? @rmfitzpatrick

@rmfitzpatrick
Copy link
Contributor Author

@fatsheep9146 I've had to table this for a bit (using a global label as a workaround) but not filtering job and instance labels overall has several knock-on effects and seems to break expected resource attributes so requires a deeper awareness of the receiver than I have atm to do correctly. Will take another look with fresher eyes soon.

@bka9
Copy link

bka9 commented Feb 17, 2023

@fatsheep9146 I've had to table this for a bit (using a global label as a workaround) but not filtering job and instance labels overall has several knock-on effects and seems to break expected resource attributes so requires a deeper awareness of the receiver than I have atm to do correctly. Will take another look with fresher eyes soon.

Can you help me understand what the global label workaround is?

@github-actions
Copy link
Contributor

This PR was marked stale due to lack of activity. It will be closed in 14 days.

@github-actions
Copy link
Contributor

This PR was marked stale due to lack of activity. It will be closed in 14 days.

@github-actions github-actions bot added the Stale label Jun 16, 2023
@github-actions
Copy link
Contributor

Closed as inactive. Feel free to reopen if this PR is still being worked on.

@github-actions github-actions bot closed this Jun 30, 2023
@shacharSirotkin
Copy link

Hi,
I'm looking for a solution for this problem.
I'm trying to federate a Prometheus and all metrics collide.

Any progress in this PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working receiver/prometheus Prometheus receiver Stale
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants