Inconsistent handling of Stat Prefix between StatsD sinks and prometheus when a Custom Stat Namespace is registered.
- Dominant language
- C++
- Stars
- 28.9k
- Forks
- 5.6k
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 437
Description
*Title*: Inconsistent handling of stat prefix between StatsD stats sinks and prometheus when a Custom Stat Namespace is registered.
*Description*:
In https://github.com/envoyproxy/envoy/pull/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.` to be `envoy.wasmcustom.` where "envoy." is the default prefix added for all stats in Envoy.
Also in https://github.com/envoyproxy/envoy/pull/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_` to just ``.
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*:
1. Requires a wasm stats extension with user-defined metrics
2. Query stats endpoint at `9901/stats` and verify the stat format as `wasmcustom.` with the "wasmcustom." prefix.
3. Use a statsD sink for exposing metrics e.g., DogStatsD.
4. Observe the exposed statsD stat is in the format `envoy.wasmcustom.` with the additional "envoy." prefix.
5. Now query the prometheus endpoint at `9901/stats/prometheus` to verify the stat format to be `` without any prefix.
Contributor guide
Assessment
This issue has not been assessed yet.