Skip to content

ext proc: fix upstream extproc grpc client stats scope - #47409

Merged
yanjunxiang-google merged 3 commits into
envoyproxy:mainfrom
wbpcode:dev-fix-ext-proc-stats
Sep 15, 2026
Merged

yanjunxiang-google merged 3 commits into
envoyproxy:mainfrom
wbpcode:dev-fix-ext-proc-stats

Conversation

@wbpcode

@wbpcode wbpcode commented Sep 13, 2026

Copy link
Copy Markdown
Member

Commit Message: ext proc: fix upstream extproc grpc client stats scope
Additional Description:

For the upstream ext_proc filter, the upstream cluster's stats scope will be used to create the google grpc client's stats scope.
But note the upstream cluster's stats scope has a cluster.<cluster_name> prefix. That result in the google grpc client's stats scope will also contains an unexpected cluster.<cluster_name> prefix.
It's unexpected because the grpc client is shared across listeners and clusters in a central cache. This unexpected prefix will make it's hard to determine the grpc client's stats.

This PR fix it by always propagating the server scope to the grpc client.

The fix will not affect the downstream ext_proc. But for the upstream ext_proc, there would be a very minor behavior change to the google grpc client's stats prefix.

Risk Level: low.
Testing: n/a.
Docs Changes: n/a.
Release Notes: added.
Platform Specific Features: n/a.

Signed-off-by: wbpcode <wbphub@gmail.com>
Signed-off-by: wbpcode <wbphub@gmail.com>
@wbpcode

wbpcode commented Sep 13, 2026

Copy link
Copy Markdown
Member Author

I personally think it's unnecessary to add a runtime flag tor this minor behavior change/bug fix. But will leave this to @yanjunxiang-google to take a check.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this comment still relevant as the scope is not passed in the lamda any more?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be changed into: Stats::Scope& scope = extra_context.scopeOr(context);

@@ -0,0 +1,5 @@
Fixed the stats scope that is used to create the gRPC client of the external processing

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to be a minor behavior change. Please move the release log to the minor_behavior_change section.

scope](Http::FilterChainFactoryCallbacks& callbacks) {
auto client =
createExternalProcessorClient(context.clusterManager().grpcAsyncClientManager(), *scope);
return [filter_config = std::move(filter_config),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a unit test in config_test.cc to verify the change.

@yanjunxiang-google

Copy link
Copy Markdown
Contributor

Thanks for fixing this! LGTM overall. Adding some minor comments.

Signed-off-by: wbpcode <wbphub@gmail.com>

@yanjunxiang-google yanjunxiang-google left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@yanjunxiang-google
yanjunxiang-google merged commit b46b983 into envoyproxy:main Sep 15, 2026
25 checks passed
@wbpcode
wbpcode deleted the dev-fix-ext-proc-stats branch September 15, 2026 16:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants