Title: Inconsistent handling of stat prefix between StatsD stats sinks and prometheus when a Custom Stat Namespace is registered.
Description:
In #17357, support for specifying a Custom Stat Namespace was added for extensions and stat sinks to register a namespace to distinguish between user-defined stats and Envoy native stats. Additionally, a default namespace of "wasmcustom" was registered for Wasm extensions. With these changes the exposed StatsD metrics changed from envoy.<metric_name> to be envoy.wasmcustom.<metric_name> where "envoy." is the default prefix added for all stats in Envoy.
Also in #17357, the prometheus stats handler was updated to handle the prefix when a custom stat namespace is registered. Changes made were as follows:
- Check for a registered custom namespace and strip the namespace prefix if it is defined from the exposed metric.
- Also remove the default "envoy_" prefix for user-defined metrics.
Therefore, with that change the user-defined metrics are exposed as-is with no prefix from prometheus and the format therefore changed from envoy_<metrics_name> to just <metric_name>.
This has made the behavior between StatsD sinks and prometheus exposed metrics inconsistent. Ideally, similar changes should be made for StatsD to make the behavior consistent with prometheus.
Repro steps:
- Requires a wasm stats extension with user-defined metrics
- Query stats endpoint at
9901/stats and verify the stat format as wasmcustom.<user-defined-metric-name> with the "wasmcustom." prefix.
- Use a statsD sink for exposing metrics e.g., DogStatsD.
- Observe the exposed statsD stat is in the format
envoy.wasmcustom.<user-defined-metric-name> with the additional "envoy." prefix.
- Now query the prometheus endpoint at
9901/stats/prometheus to verify the stat format to be <user-defined-metric-name> without any prefix.
Title: Inconsistent handling of stat prefix between StatsD stats sinks and prometheus when a Custom Stat Namespace is registered.
Description:
In #17357, support for specifying a Custom Stat Namespace was added for extensions and stat sinks to register a namespace to distinguish between user-defined stats and Envoy native stats. Additionally, a default namespace of "wasmcustom" was registered for Wasm extensions. With these changes the exposed StatsD metrics changed from
envoy.<metric_name>to beenvoy.wasmcustom.<metric_name>where "envoy." is the default prefix added for all stats in Envoy.Also in #17357, the prometheus stats handler was updated to handle the prefix when a custom stat namespace is registered. Changes made were as follows:
Therefore, with that change the user-defined metrics are exposed as-is with no prefix from prometheus and the format therefore changed from
envoy_<metrics_name>to just<metric_name>.This has made the behavior between StatsD sinks and prometheus exposed metrics inconsistent. Ideally, similar changes should be made for StatsD to make the behavior consistent with prometheus.
Repro steps:
9901/statsand verify the stat format aswasmcustom.<user-defined-metric-name>with the "wasmcustom." prefix.envoy.wasmcustom.<user-defined-metric-name>with the additional "envoy." prefix.9901/stats/prometheusto verify the stat format to be<user-defined-metric-name>without any prefix.