-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
[receiver/prometheus] feat: add Prometheus API server #33875
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm otherwise
Flags: make(map[string]string), | ||
MaxConnections: maxConnections, | ||
IsAgent: true, | ||
Gatherer: prometheus.DefaultGatherer, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
have you tested this with multiple receivers? We've had collisions between metrics in different receivers in the past when using the global gatherer. You might need to use r.registerer, or make a gatherer specific to this receiver.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @dashpole I added a test for this with multiple receivers with it enabled. It uses the r.registerer below this but it looks like the DefaultGatherer doesn't have an equivalent function to just add the label like the registerer and is for having a whole different implementation. I made sure it works with both using prometheus.DefaultGatherer but different registerers
Sorry for the slow review. Getting back from vacation |
FYI @jesusvazquez |
MaxConnections: maxConnections, | ||
IsAgent: true, | ||
Registerer: r.registerer, | ||
Gatherer: prometheus.DefaultGatherer, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can change r.registerer to a *prometheus.Registry, which implements the Gatherer and Registerer interfaces, and then use it here. Maybe rename to r.registry as well
This PR was marked stale due to lack of activity. It will be closed in 14 days. |
Closed as inactive. Feel free to reopen if this PR is still being worked on. |
Description:
This is a new PR instead of this one: #32646 which has more relevant discussion.
This PR adds the Prometheus API server as part of the Prometheus receiver if enabled through the receiver config.
It supports calling the
/config
,/targets
,/targets/metadata
,/scrape_pools
, and/metrics
paths for more debugging information about the underlying Prometheus scrape manager and discovery manager.Link to tracking Issue:
open-telemetry/wg-prometheus#63
Testing:
Added tests for the prometheus receiver configuration, for each path that the API supports, and for the server shutting down correctly. Also tested out with running the opentelemetry-collector agent with the prometheus receiver.
Documentation:
Added to the prometheus receiver README about how to configure the setting.