Skip to content

Commit 6516c73

Browse files
authoredDec 21, 2024··
xds: Remove xds authority label from metric registration (#11760)
* Remove `grpc.xds.authority` label while registering `grpc.xds_client.resources` gauge, until the label value is available to record.
1 parent ea8c31c commit 6516c73

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed
 

‎xds/src/main/java/io/grpc/xds/XdsClientMetricReporterImpl.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ final class XdsClientMetricReporterImpl implements XdsClientMetricReporter {
9090
Arrays.asList("grpc.target", "grpc.xds.server"), Collections.emptyList(), false);
9191
RESOURCES_GAUGE = metricInstrumentRegistry.registerLongGauge("grpc.xds_client.resources",
9292
"EXPERIMENTAL. Number of xDS resources.", "{resource}",
93-
Arrays.asList("grpc.target", "grpc.xds.authority", "grpc.xds.cache_state",
93+
Arrays.asList("grpc.target", "grpc.xds.cache_state",
9494
"grpc.xds.resource_type"), Collections.emptyList(), false);
9595
}
9696

‎xds/src/test/java/io/grpc/xds/XdsClientMetricReporterImplTest.java

+11-4
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
package io.grpc.xds;
1818

1919
import static com.google.common.truth.Truth.assertThat;
20+
import static org.mockito.AdditionalAnswers.delegatesTo;
2021
import static org.mockito.ArgumentMatchers.any;
2122
import static org.mockito.ArgumentMatchers.argThat;
2223
import static org.mockito.ArgumentMatchers.eq;
@@ -82,14 +83,14 @@ public class XdsClientMetricReporterImplTest {
8283
@Rule
8384
public final MockitoRule mocks = MockitoJUnit.rule();
8485

85-
@Mock
86-
private MetricRecorder mockMetricRecorder;
8786
@Mock
8887
private XdsClient mockXdsClient;
89-
@Mock
90-
private BatchRecorder mockBatchRecorder;
9188
@Captor
9289
private ArgumentCaptor<BatchCallback> gaugeBatchCallbackCaptor;
90+
private MetricRecorder mockMetricRecorder = mock(MetricRecorder.class,
91+
delegatesTo(new MetricRecorderImpl()));
92+
private BatchRecorder mockBatchRecorder = mock(BatchRecorder.class,
93+
delegatesTo(new BatchRecorderImpl()));
9394

9495
private XdsClientMetricReporterImpl reporter;
9596

@@ -372,6 +373,12 @@ public boolean matches(T instrument) {
372373
});
373374
}
374375

376+
static class MetricRecorderImpl implements MetricRecorder {
377+
}
378+
379+
static class BatchRecorderImpl implements BatchRecorder {
380+
}
381+
375382
static class TestlogHandler extends Handler {
376383
List<LogRecord> logs = new ArrayList<>();
377384

0 commit comments

Comments
 (0)
Please sign in to comment.