envoyproxy/envoy

Inconsistent handling of Stat Prefix between StatsD sinks and prometheus when a Custom Stat Namespace is registered.

Open

#19.087 geöffnet am 23. Nov. 2021

Auf GitHub ansehen
 (5 Kommentare) (0 Reaktionen) (1 zugewiesene Person)C++ (5.373 Forks)batch import
area/statsbughelp wanted

Repository-Metriken

Stars
 (27.997 Stars)
PR-Merge-Metriken
 (Durchschn. Merge 8T) (378 gemergte PRs in 30 T)

Beschreibung

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.<metric_name> to be envoy.wasmcustom.<metric_name> 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_<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:

  1. Requires a wasm stats extension with user-defined metrics
  2. Query stats endpoint at 9901/stats and verify the stat format as wasmcustom.<user-defined-metric-name> 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.<user-defined-metric-name> with the additional "envoy." prefix.
  5. Now query the prometheus endpoint at 9901/stats/prometheus to verify the stat format to be <user-defined-metric-name> without any prefix.

Contributor Guide