Skip to content

Commit b7b76d6

Browse files
committed
xds: drop backend_service metric label from ext_proc client metrics
The ext_proc spec has been updated to drop adding the backend_service metric label. TAG=agy CONV=86c74ebe-9fd7-4876-b27c-a4c1b230d346
1 parent ee59e31 commit b7b76d6

2 files changed

Lines changed: 18 additions & 25 deletions

File tree

xds/src/main/java/io/grpc/xds/ExternalProcessorClientInterceptor.java

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ static synchronized void initMetricInstruments() {
128128
"s",
129129
LATENCY_BUCKETS,
130130
ImmutableList.of("grpc.target"),
131-
ImmutableList.of("grpc.lb.backend_service"),
131+
ImmutableList.of(),
132132
true);
133133

134134
clientHalfCloseDuration = registry.registerDoubleHistogram(
@@ -138,7 +138,7 @@ static synchronized void initMetricInstruments() {
138138
"s",
139139
LATENCY_BUCKETS,
140140
ImmutableList.of("grpc.target"),
141-
ImmutableList.of("grpc.lb.backend_service"),
141+
ImmutableList.of(),
142142
true);
143143

144144
serverHeadersDuration = registry.registerDoubleHistogram(
@@ -148,7 +148,7 @@ static synchronized void initMetricInstruments() {
148148
"s",
149149
LATENCY_BUCKETS,
150150
ImmutableList.of("grpc.target"),
151-
ImmutableList.of("grpc.lb.backend_service"),
151+
ImmutableList.of(),
152152
true);
153153

154154
serverTrailersDuration = registry.registerDoubleHistogram(
@@ -158,7 +158,7 @@ static synchronized void initMetricInstruments() {
158158
"s",
159159
LATENCY_BUCKETS,
160160
ImmutableList.of("grpc.target"),
161-
ImmutableList.of("grpc.lb.backend_service"),
161+
ImmutableList.of(),
162162
true);
163163
}
164164
}
@@ -248,8 +248,7 @@ public <ReqT, RespT> ClientCall<ReqT, RespT> interceptCall(
248248

249249
DataPlaneClientCall dataPlaneCall = new DataPlaneClientCall(
250250
delayedCall, rawCall, extProcStub, filterConfig, filterConfig.getMutationRulesConfig(),
251-
scheduler, rawMethod, next, metricsRecorder, next.authority(),
252-
callOptions.getOption(XdsNameResolver.CLUSTER_SELECTION_KEY));
251+
scheduler, rawMethod, next, metricsRecorder, next.authority());
253252

254253
return (ClientCall<ReqT, RespT>) (ClientCall<?, ?>) dataPlaneCall;
255254
}
@@ -294,7 +293,6 @@ private static class DataPlaneClientCall
294293
private final Channel channel;
295294
private final MetricRecorder metricsRecorder;
296295
private final String target;
297-
private final String backendService;
298296
private volatile Context callContext = Context.ROOT;
299297

300298
private long clientHeadersStartNanos;
@@ -326,8 +324,7 @@ protected DataPlaneClientCall(
326324
MethodDescriptor<?, ?> method,
327325
Channel channel,
328326
MetricRecorder metricsRecorder,
329-
String target,
330-
String backendService) {
327+
String target) {
331328
super(delayedCall);
332329
this.delayedCall = delayedCall;
333330
this.rawCall = rawCall;
@@ -340,7 +337,6 @@ protected DataPlaneClientCall(
340337
this.channel = channel;
341338
this.metricsRecorder = checkNotNull(metricsRecorder, "metricsRecorder");
342339
this.target = checkNotNull(target, "target");
343-
this.backendService = checkNotNull(backendService, "backendService");
344340
}
345341

346342

@@ -373,7 +369,7 @@ private void recordDuration(DoubleHistogramMetricInstrument instrument, long dur
373369
instrument,
374370
durationSecs,
375371
ImmutableList.of(target),
376-
ImmutableList.of(backendService));
372+
ImmutableList.of());
377373
}
378374
}
379375

xds/src/test/java/io/grpc/xds/ExternalProcessorClientInterceptorTest.java

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,7 @@ public class ExternalProcessorClientInterceptorTest {
128128
private ExternalProcessorFilter.Provider provider;
129129
private static final Filter.FilterContext FAKE_CONTEXT = Filter.FilterContext.create(
130130
"test-filter", new io.grpc.MetricRecorder() {});
131-
private static final CallOptions DEFAULT_CALL_OPTIONS = CallOptions.DEFAULT
132-
.withOption(XdsNameResolver.CLUSTER_SELECTION_KEY, "backend-service-metric");
131+
private static final CallOptions DEFAULT_CALL_OPTIONS = CallOptions.DEFAULT;
133132
private Filter.FilterConfigParseContext filterContext;
134133
private Bootstrapper.BootstrapInfo bootstrapInfo;
135134
private Bootstrapper.ServerInfo serverInfo;
@@ -13523,8 +13522,7 @@ public void onCompleted() {
1352313522
ClientCall<String, String> proxyCall =
1352413523
interceptCall(interceptor,
1352513524
METHOD_SAY_HELLO,
13526-
DEFAULT_CALL_OPTIONS.withExecutor(MoreExecutors.directExecutor())
13527-
.withOption(XdsNameResolver.CLUSTER_SELECTION_KEY, "backend-service-metric"),
13525+
DEFAULT_CALL_OPTIONS.withExecutor(MoreExecutors.directExecutor()),
1352813526
dataPlaneChannel);
1352913527

1353013528
proxyCall.start(new ClientCall.Listener<String>() {
@@ -13555,25 +13553,25 @@ public void onCompleted() {
1355513553
Mockito.eq(ExternalProcessorClientInterceptor.clientHeadersDuration),
1355613554
Mockito.anyDouble(),
1355713555
Mockito.eq(com.google.common.collect.ImmutableList.of("xds:///target-service-metric")),
13558-
Mockito.eq(com.google.common.collect.ImmutableList.of("backend-service-metric")));
13556+
Mockito.eq(com.google.common.collect.ImmutableList.of()));
1355913557

1356013558
Mockito.verify(mockMetricRecorder, Mockito.times(1)).recordDoubleHistogram(
1356113559
Mockito.eq(ExternalProcessorClientInterceptor.clientHalfCloseDuration),
1356213560
Mockito.anyDouble(),
1356313561
Mockito.eq(com.google.common.collect.ImmutableList.of("xds:///target-service-metric")),
13564-
Mockito.eq(com.google.common.collect.ImmutableList.of("backend-service-metric")));
13562+
Mockito.eq(com.google.common.collect.ImmutableList.of()));
1356513563

1356613564
Mockito.verify(mockMetricRecorder, Mockito.times(1)).recordDoubleHistogram(
1356713565
Mockito.eq(ExternalProcessorClientInterceptor.serverHeadersDuration),
1356813566
Mockito.anyDouble(),
1356913567
Mockito.eq(com.google.common.collect.ImmutableList.of("xds:///target-service-metric")),
13570-
Mockito.eq(com.google.common.collect.ImmutableList.of("backend-service-metric")));
13568+
Mockito.eq(com.google.common.collect.ImmutableList.of()));
1357113569

1357213570
Mockito.verify(mockMetricRecorder, Mockito.times(1)).recordDoubleHistogram(
1357313571
Mockito.eq(ExternalProcessorClientInterceptor.serverTrailersDuration),
1357413572
Mockito.anyDouble(),
1357513573
Mockito.eq(com.google.common.collect.ImmutableList.of("xds:///target-service-metric")),
13576-
Mockito.eq(com.google.common.collect.ImmutableList.of("backend-service-metric")));
13574+
Mockito.eq(com.google.common.collect.ImmutableList.of()));
1357713575

1357813576
channelManager.close();
1357913577
realScheduler.shutdown();
@@ -13690,8 +13688,7 @@ public <ReqT, RespT> ServerCall.Listener<ReqT> interceptCall(
1369013688
ClientCall<String, String> proxyCall =
1369113689
interceptCall(interceptor,
1369213690
METHOD_SAY_HELLO,
13693-
DEFAULT_CALL_OPTIONS.withExecutor(MoreExecutors.directExecutor())
13694-
.withOption(XdsNameResolver.CLUSTER_SELECTION_KEY, "backend-service-metric-fail"),
13691+
DEFAULT_CALL_OPTIONS.withExecutor(MoreExecutors.directExecutor()),
1369513692
dataPlaneChannel);
1369613693

1369713694
proxyCall.start(new ClientCall.Listener<String>() {
@@ -13725,25 +13722,25 @@ public <ReqT, RespT> ServerCall.Listener<ReqT> interceptCall(
1372513722
Mockito.eq(ExternalProcessorClientInterceptor.clientHeadersDuration),
1372613723
Mockito.anyDouble(),
1372713724
Mockito.eq(com.google.common.collect.ImmutableList.of("xds:///target-service-metric-fail")),
13728-
Mockito.eq(com.google.common.collect.ImmutableList.of("backend-service-metric-fail")));
13725+
Mockito.eq(com.google.common.collect.ImmutableList.of()));
1372913726

1373013727
Mockito.verify(mockMetricRecorder, Mockito.times(1)).recordDoubleHistogram(
1373113728
Mockito.eq(ExternalProcessorClientInterceptor.clientHalfCloseDuration),
1373213729
Mockito.anyDouble(),
1373313730
Mockito.eq(com.google.common.collect.ImmutableList.of("xds:///target-service-metric-fail")),
13734-
Mockito.eq(com.google.common.collect.ImmutableList.of("backend-service-metric-fail")));
13731+
Mockito.eq(com.google.common.collect.ImmutableList.of()));
1373513732

1373613733
Mockito.verify(mockMetricRecorder, Mockito.times(1)).recordDoubleHistogram(
1373713734
Mockito.eq(ExternalProcessorClientInterceptor.serverHeadersDuration),
1373813735
Mockito.anyDouble(),
1373913736
Mockito.eq(com.google.common.collect.ImmutableList.of("xds:///target-service-metric-fail")),
13740-
Mockito.eq(com.google.common.collect.ImmutableList.of("backend-service-metric-fail")));
13737+
Mockito.eq(com.google.common.collect.ImmutableList.of()));
1374113738

1374213739
Mockito.verify(mockMetricRecorder, Mockito.times(1)).recordDoubleHistogram(
1374313740
Mockito.eq(ExternalProcessorClientInterceptor.serverTrailersDuration),
1374413741
Mockito.anyDouble(),
1374513742
Mockito.eq(com.google.common.collect.ImmutableList.of("xds:///target-service-metric-fail")),
13746-
Mockito.eq(com.google.common.collect.ImmutableList.of("backend-service-metric-fail")));
13743+
Mockito.eq(com.google.common.collect.ImmutableList.of()));
1374713744

1374813745
channelManager.close();
1374913746
realScheduler.shutdown();

0 commit comments

Comments
 (0)