-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
stats: expose Prometheus metrics as /metrics
#2182
Comments
As discussed in the other issue, we decided to stick with |
thanks for the feedback, @mattklein123! I didn't see that decision in the comments on #1947 or #2026, so I suspected the path was an oversight. |
As |
BTW, anyone tried using |
Tried using:
which ends-up with :
Possibly similar to - deadtrickster/prometheus_rabbitmq_exporter#19 |
@shahsaifi this might just be a prometheus configuration thing, maybe just ask on IRC or the Prometheus users mailing list, however, I haven't tried the Prometheus support myself yet. |
Maybe this helps you, but following Prometheus config works fine for me (running Prometheus in Docker container and Envoy is available as 'envoy' in same Docker network):
|
It worked with |
@krootee use this config ,The prometheus error no token found, why? |
May not have seen all of the discussions around this - but just wondering if there has been any consideration of what should happen if envoy proxy does use Will envoy forward the request to the service still, but then add its own metrics to the response? |
@objectiser Only the admin endpoint exposes Envoy's stats on /metrics, and the admin endpoint never proxies, so it shouldn't be an issue. |
For Prometheus url parameters are not very nice, because if you use its service discovery mechanism you must know the name of the parameter in advance. This is why e.G. the Prometheus samples for the Kuberntetes service discovery don't even assume they are used. Would it alternatively be possible to have an additonal route |
Requiring the param for Prometheus scraping may be incompatible with the scrape via Kubernetes annotation pattern which is supported by the Prometheus Helm chart in the kubernetes/charts repo. +1 |
|
At that point, why not go with the Prometheus standard |
Not sure if it is nicer to follow up @mattklein123's comment here, by having e.g. admin:
override_endpoint_paths:
"/metrics":
path: "/stats"
query:
format: prometheus
foo: bar The |
Because IMO it's confusing to have
@dio that's a good idea and I think that would work, but my preference is to avoid complexity unless it's really need. Additionally, in the future we are going to promote the admin listener into more of a full listener. It's possible at that point it could have proper routes include prefix_rewrite if needed. |
This patch adds /stats/prometheus handler to print server stats in prometheus format. Fixes #2182. Signed-off-by: Dhi Aurrahman <[email protected]>
What we've done to workaround this: set up a separate listener where we use a route_config:
name: local_route
virtual_hosts:
{
name: local_service,
domains: ["*"],
routes: [
{
match: { prefix: "/metrics" },
route:
{
cluster: envoy-admin,
prefix_rewrite: "/stats/prometheus"
}
}
]
} ...with a cluster config like this: - name: envoy-admin
connect_timeout: 0.25s
type: STATIC
load_assignment: {
cluster_name: envoy-admin,
endpoints: {
lb_endpoints: [
{
endpoint: {
address: {
socket_address: { address: 127.0.0.1, port_value: 9901 },
}
}
}
]
}
} This works quite well, and means that no special configuration is needed on the Prometheus side. @mattklein123 While I understand and respect your reasoning from an Envoy perspective, I would highly appreciate if this was reconsidered. We currently use 13 different kinds of Prometheus endpoints in our current While the "Writing Exporters" document from the Prometheus web site doesn't explicitly mandate that the scrape endpoint should be named
[...]
(This is clearly speaking about out-of-process exporters, which "own" their entire HTTP namespace.) Cheers & have a nice weekend. 👍 |
…y#2182) * Retrieve tracing header at report time * add license header * format * add an integration test * format * clean comment
Thank you @perlun for the suggestion and configuration skeleton in Envoy issue envoyproxy/envoy#2182
@perlun thank you for the configuration snippets to expose Prometheus metrics at |
Title: expose Prometheus metrics as
/metrics
Description:
By convention, Prometheus expects metrics to be exposed via the endpoint
/metrics
. While it is possible to override the scraping endpoint vie explicit configuration, this may complicate deployments for users. The implementation in #2026 exposes the metrics as/stats?format=prometheus
.@brancz brought this up in #1947. @mattklein123 and @lita agreed (#1947 (comment) / #1947 (comment)), but #2026 went with
/stats?format=prometheus
.The text was updated successfully, but these errors were encountered: