Skip to content

enable child channel plugins#12578

Open
AgraVator wants to merge 21 commits into
grpc:masterfrom
AgraVator:child-channel-plugin
Open

enable child channel plugins#12578
AgraVator wants to merge 21 commits into
grpc:masterfrom
AgraVator:child-channel-plugin

Conversation

@AgraVator

@AgraVator AgraVator commented Dec 22, 2025

Copy link
Copy Markdown
Contributor

Implements grpc/proposal#529

Comment on lines +34 to +37
ObjectPool<XdsClient> getOrCreate(
String target, BootstrapInfo bootstrapInfo, MetricRecorder metricRecorder,
ManagedChannel parentChannel);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Should this be a generic object instead of ManagedChannel ?

Comment on lines +130 to +149
return new XdsServerWrapper("0.0.0.0:" + port, delegate, xdsServingStatusListener,
filterChainSelectorManager, xdsClientPoolFactory, bootstrapOverride, filterRegistry);
filterChainSelectorManager, xdsClientPoolFactory, bootstrapOverride, filterRegistry,
this.childChannelConfigurer);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Why does this not pass the builder object ?

kannanjgithub
kannanjgithub previously approved these changes Jan 6, 2026
Comment thread api/src/main/java/io/grpc/ChildChannelConfigurer.java Outdated
Comment thread api/src/main/java/io/grpc/ChildChannelConfigurer.java Outdated

@ejona86 ejona86 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I know there will be changes based on the gRFC discussion, but here are some things I noticed.

Comment thread api/src/main/java/io/grpc/ChildChannelConfigurers.java Outdated
Comment thread api/src/main/java/io/grpc/ChildChannelConfigurers.java Outdated
Comment thread api/src/main/java/io/grpc/ManagedChannel.java Outdated
Comment thread api/src/main/java/io/grpc/Server.java Outdated
@AgraVator AgraVator marked this pull request as ready for review March 18, 2026 09:04
Comment thread api/src/main/java/io/grpc/ChannelConfigurer.java Outdated
Comment thread api/src/main/java/io/grpc/MetricRecorder.java Outdated
Comment thread api/src/main/java/io/grpc/ManagedChannelBuilder.java Outdated
Comment thread core/src/main/java/io/grpc/internal/ManagedChannelImplBuilder.java Outdated
@AgraVator AgraVator requested a review from kannanjgithub June 3, 2026 11:55
@AgraVator AgraVator requested a review from ejona86 June 3, 2026 11:55
Comment thread api/src/main/java/io/grpc/ChannelConfigurator.java Outdated
Comment thread api/src/main/java/io/grpc/ChannelConfigurator.java Outdated
Comment on lines +641 to +639
@Internal
protected T addMetricSink(MetricSink metricSink) {
public T addMetricSink(MetricSink metricSink) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

What's happening here? Why will this no longer be internal? Even if we were going to make it public, we wouldn't have it go immediately stable; it'd be experimental first.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

When an application or test implements ChannelConfigurator, it receives a reference to the child channel's ManagedChannelBuilder.
If addMetricSink were protected (or package-private), then class implementations of ChannelConfigurator outside of the io.grpc package (such as user applications or test suites like FakeControlPlaneXdsIntegrationTest.java) would not be able to call builder.addMetricSink(sink) to register their metric sinks.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

What is the problem with that? What new thing do they need to do because of ChannelConfigurator? If addMetricSink() being hidden was a problem, wouldn't that be a pre-existing problem?

GrpcOpenTelemetry.configureChannelBuilder() still works fine with ChannelConfigurator, and it calls addMetricSink() on the user's behalf.

Comment thread api/src/main/java/io/grpc/ManagedChannelBuilder.java
Comment thread api/src/main/java/io/grpc/ServerBuilder.java Outdated
Comment thread api/src/main/java/io/grpc/NameResolver.java Outdated
Comment thread xds/src/main/java/io/grpc/xds/XdsNameResolver.java Outdated
Comment thread xds/src/main/java/io/grpc/xds/XdsServerBuilder.java Outdated
Comment thread xds/src/main/java/io/grpc/xds/XdsServerBuilder.java
// NamedFilterConfig.filterStateKey -> filter_instance.
private final HashMap<String, Filter> activeFiltersDefaultChain = new HashMap<>();

private ChannelConfigurator channelConfigurator = new ChannelConfigurator() {};

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We really want this field to be final. I see there is some difficulty with the constructors here, but we should handle that with another constructor that has both ScheduledExecutorService and ChannelConfigurator.

(And we should really clean this up by using ObjectPool/SharedResourcePool/FixedObjectPool to get rid of sharedTimeService. But that is pre-existing.)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I've sent out #12841 to clean that up. Obviously the two PRs will conflict. I'm fine with waiting until this goes in and handling the conflicts. If you want it to go in first to clean up this PR, just tell me.

@AgraVator AgraVator requested a review from ejona86 June 8, 2026 06:35
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.

3 participants