wasm: use root stats scope for upstream filter stats#45242
Conversation
9bf2bde to
7b6f121
Compare
|
@kyessenov Gentle ping when you get a chance. This PR implements the root-scope approach discussed in #45065. |
kyessenov
left a comment
There was a problem hiding this comment.
Looks close, but I think test could be better.
| Upstream HTTP Wasm filter stats now use the server-wide root stats scope instead of the | ||
| cluster stats scope, matching downstream HTTP Wasm filter scoping. Upstream Wasm custom metrics | ||
| no longer carry a ``cluster.<cluster_name>.`` prefix; for example a counter previously exposed as | ||
| ``envoy_cluster_wasmcustom_foo{envoy_cluster_name="X"}`` is now ``foo``. Plugins that need |
There was a problem hiding this comment.
Is it wasmcustom_foo or just foo? I think the prefix still applies?
There was a problem hiding this comment.
Done — split admin /stats vs Prometheus output to clarify the prefix behavior.
| EXPECT_NE(nullptr, | ||
| TestUtility::findCounter(upstream_factory_context_.server_factory_context_.store_, | ||
| lifecycle_counter)); | ||
| EXPECT_EQ(nullptr, |
There was a problem hiding this comment.
This should be a positive test, e.g. please spell out the full path for the stat.
7b6f121 to
fd15232
Compare
|
/retest |
fd15232 to
aa2f87d
Compare
|
/retest |
|
@kyessenov Friendly ping — addressed both review comments in the latest push. |
|
PTAL @kyessenov |
kyessenov
left a comment
There was a problem hiding this comment.
Minor comment to improve test. LMK.
/wait
| const auto counter = TestUtility::findCounter( | ||
| upstream_factory_context_.server_factory_context_.store_, full_stat_name); | ||
| ASSERT_NE(nullptr, counter); | ||
| } |
There was a problem hiding this comment.
This should be a positive test, e.g. please spell out the full path for the stat.
There was a problem hiding this comment.
Updated with a positive check using the full literal stat path.
Upstream HTTP Wasm filter stats currently use the cluster stats scope, while downstream HTTP Wasm filter stats use the server-wide root scope. This causes upstream custom metrics to inherit the cluster prefix and Prometheus cluster label, even though Wasm extension stats should be scoped consistently across downstream and upstream filters. Use the server-wide root stats scope for upstream HTTP Wasm filter stats and keep the old cluster-scope behavior behind the envoy.reloadable_features.upstream_wasm_filter_uses_root_scope runtime guard. Setting the guard to false temporarily reverts to the previous behavior. Signed-off-by: Yueshang zuo <zuoyueshang.zys@alibaba-inc.com>
aa2f87d to
17f851f
Compare
|
/retest |
1 similar comment
|
/retest |
Supersedes envoyproxy#45065. Implements the root-scope approach surfaced in that review discussion. Commit Message: wasm: use root stats scope for upstream filter stats Additional Description: Upstream HTTP Wasm filter stats currently use the cluster stats scope, while downstream HTTP Wasm filter stats use the root scope. This makes the same Wasm metric name produce different stat names depending on whether the plugin is loaded as a downstream or upstream filter. This changes upstream HTTP Wasm filter stats to use the server-wide root stats scope by default, matching the downstream filter. In Prometheus, a counter previously exposed as `envoy_cluster_wasmcustom_foo{envoy_cluster_name="X"}` is now exposed as `foo`. The previous cluster-scope behavior can be temporarily restored with the `envoy.reloadable_features.upstream_wasm_filter_uses_root_scope` runtime guard set to `false`. Risk Level: Medium Testing: - `git diff --check` - `bazel test -c dbg //test/extensions/filters/http/wasm:config_test` - `bazel build -c dbg envoy` - Manual Envoy smoke test with upstream Wasm stats and runtime-guard rollback. Docs Changes: N/A Release Notes: Added in `changelogs/current/minor_behavior_changes/wasm__upstream-http-wasm-stats-use-root-scope.rst`. Platform Specific Features: N/A [Optional Runtime guard:] `envoy.reloadable_features.upstream_wasm_filter_uses_root_scope`, defaults to true. Set to false to restore the previous upstream Wasm cluster-scope stats behavior. [Optional Fixes #Issue:] N/A [Optional Deprecated:] N/A [Optional API Considerations:] N/A [Optional AI Disclosure:] This PR was prepared with assistance from generative AI; the code and behavior were reviewed and tested by the author. Signed-off-by: Yueshang zuo <zuoyueshang.zys@alibaba-inc.com>
Supersedes #45065. Implements the root-scope approach surfaced in that review discussion.
Commit Message:
wasm: use root stats scope for upstream filter stats
Additional Description:
Upstream HTTP Wasm filter stats currently use the cluster stats scope, while downstream HTTP Wasm filter stats use the root scope. This makes the same Wasm metric name produce different stat names depending on whether the plugin is loaded as a downstream or upstream filter.
This changes upstream HTTP Wasm filter stats to use the server-wide root stats scope by default, matching the downstream filter. In Prometheus, a counter previously exposed as
envoy_cluster_wasmcustom_foo{envoy_cluster_name="X"}is now exposed asfoo. The previous cluster-scope behavior can be temporarily restored with theenvoy.reloadable_features.upstream_wasm_filter_uses_root_scoperuntime guard set tofalse.Risk Level: Medium
Testing:
git diff --checkbazel test -c dbg //test/extensions/filters/http/wasm:config_testbazel build -c dbg envoyDocs Changes: N/A
Release Notes: Added in
changelogs/current/minor_behavior_changes/wasm__upstream-http-wasm-stats-use-root-scope.rst.Platform Specific Features: N/A
[Optional Runtime guard:]
envoy.reloadable_features.upstream_wasm_filter_uses_root_scope, defaults to true. Set to false to restore the previous upstream Wasm cluster-scope stats behavior.[Optional Fixes #Issue:] N/A
[Optional Deprecated:] N/A
[Optional API Considerations:] N/A
[Optional AI Disclosure:]
This PR was prepared with assistance from generative AI; the code and behavior were reviewed and tested by the author.