xds: Remove xds authority label from metric registration

* Remove `grpc.xds.authority` label while registering `grpc.xds_client.resources` gauge, until the label value is available to record.
This commit is contained in:
Vindhya Ningegowda 2025-01-14 21:23:23 -08:00 committed by GitHub
parent e3e343db8e
commit 0de7bfefb9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 12 additions and 5 deletions

View File

@ -90,7 +90,7 @@ final class XdsClientMetricReporterImpl implements XdsClientMetricReporter {
Arrays.asList("grpc.target", "grpc.xds.server"), Collections.emptyList(), false);
RESOURCES_GAUGE = metricInstrumentRegistry.registerLongGauge("grpc.xds_client.resources",
"EXPERIMENTAL. Number of xDS resources.", "{resource}",
Arrays.asList("grpc.target", "grpc.xds.authority", "grpc.xds.cache_state",
Arrays.asList("grpc.target", "grpc.xds.cache_state",
"grpc.xds.resource_type"), Collections.emptyList(), false);
}

View File

@ -17,6 +17,7 @@
package io.grpc.xds;
import static com.google.common.truth.Truth.assertThat;
import static org.mockito.AdditionalAnswers.delegatesTo;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.argThat;
import static org.mockito.ArgumentMatchers.eq;
@ -82,14 +83,14 @@ public class XdsClientMetricReporterImplTest {
@Rule
public final MockitoRule mocks = MockitoJUnit.rule();
@Mock
private MetricRecorder mockMetricRecorder;
@Mock
private XdsClient mockXdsClient;
@Mock
private BatchRecorder mockBatchRecorder;
@Captor
private ArgumentCaptor<BatchCallback> gaugeBatchCallbackCaptor;
private MetricRecorder mockMetricRecorder = mock(MetricRecorder.class,
delegatesTo(new MetricRecorderImpl()));
private BatchRecorder mockBatchRecorder = mock(BatchRecorder.class,
delegatesTo(new BatchRecorderImpl()));
private XdsClientMetricReporterImpl reporter;
@ -372,6 +373,12 @@ public class XdsClientMetricReporterImplTest {
});
}
static class MetricRecorderImpl implements MetricRecorder {
}
static class BatchRecorderImpl implements BatchRecorder {
}
static class TestlogHandler extends Handler {
List<LogRecord> logs = new ArrayList<>();