Metrics in the "scrape" package can now be registered with a non-default registry#12958
Merged
beorn7 merged 1 commit intoprometheus:mainfrom Oct 24, 2023
Conversation
* A registerer is passed to the scrape Manager, and all scrape metrics register with it. * For now the registry which we pass to the scrape Manager is still the global one. Signed-off-by: Paulin Todev <paulin.todev@gmail.com>
c1aceae to
5752050
Compare
Member
|
Will have a look ASAP. (Still on my way back from SREcon. @ptodev it was nice meeting you on my way back in London. ;) ) |
beorn7
approved these changes
Oct 19, 2023
Member
beorn7
left a comment
There was a problem hiding this comment.
OK, I guess nothing surprising in this change. I give it a few days to see if @roidelapluie and @LeviHarrison as the repo maintainers have any concerns.
Contributor
Author
@beorn7 Thank you so much for the advice, for the review, and for coming over to London! It was great to meet up! 😊 I also raised #13023 to make a similar change to the SD packages. It is not urgent, but I would appreciate if you could take a look sometime please. |
Aneurysm9
added a commit
to Aneurysm9/prometheus
that referenced
this pull request
Feb 19, 2024
PR prometheus#12958 introduced the ability to provide a registerer when creating a scrape manager, but this did not account for the possibility of using multiple scrape managers with the same registerer. This change simply ignores the `prometheus.AlreadyRegisteredError` when attempting to register scraper metric collectors. Fixes prometheus#13507 Signed-off-by: Anthony J Mirabella <a9@aneurysm9.com>
dmitryax
pushed a commit
to open-telemetry/opentelemetry-collector-contrib
that referenced
this pull request
Mar 25, 2024
…30934) Fixes #30883 Prometheus PR we need to adapt to: prometheus/prometheus#12738 The configuration option we were using to enable protobuf has been removed, so this PR removes the `enable_protobuf_negotiation` configuration on the prometheus receiver. In its place, the prometheus server now has a config option, `scrape_protocols`, which specifies which protocols it uses, including protobuf. Use `config.global.scrape_protocols = [ PrometheusProto, OpenMetricsText1.0.0, OpenMetricsText0.0.1, PrometheusText0.0.4 ]` to enable protobuf scraping instead of using our option. Prometheus PR we need to adapt to: prometheus/prometheus#12958 We now need to pass a prometheus.Registerer to the scrape manager to collect metrics about scrapes. This PR disables the collection of these scrape metrics from the prometheus server. We did not use the default registry, so we were previously collecting these metrics and never exposing them. This PR passes a no-op registerer to prevent using memory to store those metrics. In the future, we can consider using the prometheus -> OTel bridge to export these with the self-observability pipeline.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A Registerer is passed to the scrape Manager, and all scrape metrics register with it. For now the registry which we pass to the scrape Manager is still the global one.
I tested this locally by running a Prometheus which scrapes itself. I checked the
http://localhost:9090/metricsmetrics address for a local Prometheus and I see all scrape metrics which I also see using a binary from themainbranch.