upstream_network_filter: add stats_prefix to NamedUpstreamNetworkFilterConfigFactory#37
Merged
fl0Lec merged 3 commits intoJul 13, 2026
Conversation
…erConfigFactory Add a stats_prefix parameter to createFilterFactoryFromProto on NamedUpstreamNetworkFilterConfigFactory, mirroring the upstream HTTP filter API. This allows upstream_impl.cc to pass 'cluster.<name>.' explicitly so network filters can emit stats under the cluster namespace even when upstream_context_ uses root scope. A 2-arg convenience overload is kept for the ECDS dynamic path which hasn't been updated to thread stats_prefix through yet (TODO in UpstreamNetworkDynamicFilterConfigProviderImpl). Signed-off-by: Florent Lecoultre <florent.lecoultre@datadoghq.com>
…erride The 2-arg convenience overload on NamedUpstreamNetworkFilterConfigFactory already handles the base class call in NetworkDynamicFilterConfigProviderImplBase. The override in config_discovery_impl.h was doing exactly the same thing. Move the TODO to filter_config.h where the actual gap lives. Signed-off-by: Florent Lecoultre <florent.lecoultre@datadoghq.com>
…re with default delegation The 2-arg createFilterFactoryFromProto remains PURE so all existing implementations continue to compile without any change. The new 3-arg overload (with stats_prefix) is non-pure virtual and defaults to calling the 2-arg form, allowing callers like upstream_impl to pass an explicit "cluster.<name>." prefix while backward-compatible filters (including reverse_tunnel) need not be touched. Reverts the reverse_tunnel signature change from the previous commit. Signed-off-by: Florent Lecoultre <florent.lecoultre@datadoghq.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Context
Follow-up to envoyproxy#45987. The reviewer asked to use
serverScope()forupstream_context_and pass"cluster.<name>."explicitly asstats_prefix, mirroring the router pattern. The problem:upstream_context_is shared by both network and HTTP filter factories, and the network filter API has nostats_prefixparameter — any filter callingcontext.scope()directly would get root scope and emit unnamespaced stats.This PR
Adds
stats_prefixtoNamedUpstreamNetworkFilterConfigFactory::createFilterFactoryFromProto, bringing it in line with the HTTP filter API. Both network and HTTP filter factories now receive"cluster.<name>."explicitly, andupstream_context_can cleanly useserverScope().Changes
envoy/server/filter_config.h: addstats_prefixtoNamedUpstreamNetworkFilterConfigFactory. A 2-arg convenience overload (delegating with"") keeps the ECDS dynamic path compiling pending a follow-up to threadstats_prefixthroughFilterConfigProviderManagerImpl.source/extensions/bootstrap/reverse_tunnel/: update the only production implementation (ignoresstats_prefix, no behaviour change).source/common/upstream/upstream_impl.cc: switchupstream_context_toserverScope(), pass"cluster.<name>."for both network and HTTP filter creation.source/common/filter/config_discovery_impl.h: overrideinstantiateFilterFactoryinUpstreamNetworkDynamicFilterConfigProviderImplwith a TODO for the ECDS path.test/integration/idle_timeout_integration_test.cc: test filter updated to create a subscope fromstats_prefix.Known limitation
ECDS dynamic upstream network filters still receive
stats_prefix=""via the 2-arg convenience overload. Full fix requires threadingstats_prefixthroughFilterConfigProviderManagerImpl::createDynamicFilterConfigProvider— left as a follow-up.