prometheus: allow stats to be opt out from automatic namespacing#11808
prometheus: allow stats to be opt out from automatic namespacing#11808ggreenway merged 6 commits intoenvoyproxy:masterfrom
Conversation
Signed-off-by: Lizan Zhou <lizan@tetrate.io>
ggreenway
left a comment
There was a problem hiding this comment.
Can you explain how this is used in practice? What happens if a stat is prefixed with _ and statsd is used instead of prometheus? Who is going to use this convention, and what if we need to change this for some reason?
|
@ggreenway istio stats extensions (s) use it to export metrics with metrics names that are arbitrarily namespaces. For ex ‘Istio_requests_total’ would be ‘envoy_istio_request_total’ without this change. |
|
@ggreenway see #7957 |
|
@ggreenway it doesn't affect statsd or other stuff, it allows extensions to register stats that not being automatically namespaced in prometheus stats. more context are in the issue. |
What I mean is that if you have stats starting with In general, I'm not a fan of encoding things like this into strings. It would be better if a flag could be set on the stat when it is created, or possibly create some rules (regex based maybe?) for which stats should be treated differently. @jmarantz is there a way to keep this metadata with a stat, and set it on creation? |
|
It should be possible (just annoying due to mocks) to use some spare bits in stats flags for things like this if they are deemed important enough. There are quite a few bits left now in padding. See envoy/include/envoy/stats/stats.h Line 96 in 5569744 There a 16 flag bits of which we are using 3 now, and 2 of those are only used for Gauges. |
Yes it will be, it will be up to the extension to prefix or not.
Configurable rules doesn't work well when an extension is loaded dynamically (e.g. wasm).
@jmarantz @ggreenway my take was it isn't important enough for a bit there, but if you feel so I can use that. |
|
I wasn't voting on importance... Was commenting on feasibility :) |
|
@ggreenway one requirement is that Changing Filter config thru XDS, does not require changing bootstrap, even with bootstrap
|
|
Given that your use-case is for a filter to opt it's metrics out of namespacing, what if we added an API so that filters could register a prefix (at filter load time) to opt out of namespacing? So you could prefix all your metrics with |
|
@ggreenway are you suggesting that a statsScope opts out of namespacing during scope creation? But I do like the solution since it does not add any XDS or bootstrap config. |
Not exactly. I'm suggesting that for the stats you want to exclude from namespacing, you come up with a prefix specific to your filter that you prepend on all your stat names, eg |
The details of the |
|
We can call registerPrometheusPrefixList the first time any Wasm module loads. |
Yes, that sounds find. If that's tricky to track, you could maybe use something like |
|
/wait |
Signed-off-by: Lizan Zhou <lizan@tetrate.io>
ggreenway
left a comment
There was a problem hiding this comment.
I like this approach. Looks good overall, just a few minor points, and CI needs to be fixed.
/wait
|
@ggreenway ping? |
…oyproxy#11808) Filters can register prefixes that will not have the normal `envoy_` namespace. Signed-off-by: Lizan Zhou <lizan@tetrate.io> Signed-off-by: scheler <santosh.cheler@appdynamics.com>
Commit Message:
From envoyproxy/envoy-wasm#138. Just add the conventional prefix for now until we see some reason to make it configurable.
Additional Description:
Risk Level: Low
Testing: CI
Docs Changes: code level doc (not user facing)
Release Notes: N/A
Fixes #7957