File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2121import com .google .common .base .MoreObjects ;
2222import com .google .protobuf .Message ;
2323import io .grpc .ClientInterceptor ;
24+ import io .grpc .MetricRecorder ;
2425import io .grpc .ServerInterceptor ;
2526import io .grpc .xds .client .Bootstrapper .BootstrapInfo ;
2627import io .grpc .xds .client .Bootstrapper .ServerInfo ;
@@ -91,7 +92,7 @@ default boolean isServerFilter() {
9192 * <li>Filter name+typeUrl in FilterChain's HCM.http_filters.</li>
9293 * </ol>
9394 */
94- Filter newInstance (String name );
95+ Filter newInstance (FilterContext context );
9596
9697 /**
9798 * Parses the top-level filter config from raw proto message. The message may be either a {@link
@@ -152,6 +153,18 @@ abstract static class Builder {
152153 }
153154 }
154155
156+ /** Context containing naming and metrics reporting objects for a filter instance. */
157+ @ AutoValue
158+ abstract static class FilterContext {
159+ abstract String filterName ();
160+
161+ abstract MetricRecorder metricsRecorder ();
162+
163+ static FilterContext create (String filterName , MetricRecorder metricsRecorder ) {
164+ return new AutoValue_Filter_FilterContext (filterName , metricsRecorder );
165+ }
166+ }
167+
155168 /** Filter config with instance name. */
156169 final class NamedFilterConfig {
157170 // filter instance name
Original file line number Diff line number Diff line change @@ -108,7 +108,7 @@ public boolean isServerFilter() {
108108 }
109109
110110 @ Override
111- public synchronized StatefulFilter newInstance (String name ) {
111+ public synchronized StatefulFilter newInstance (FilterContext context ) {
112112 StatefulFilter filter = new StatefulFilter (counter ++);
113113 instances .put (filter .idx , filter );
114114 return filter ;
You can’t perform that action at this time.
0 commit comments