Skip to content

Commit

Permalink
xds: Remove xds authority label from metric registration
Browse files Browse the repository at this point in the history
* Remove `grpc.xds.authority` label while registering `grpc.xds_client.resources` gauge, until the label value is available to record.
  • Loading branch information
DNVindhya authored Jan 15, 2025
1 parent e3e343d commit 0de7bfe
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
15 changes: 11 additions & 4 deletions xds/src/test/java/io/grpc/xds/XdsClientMetricReporterImplTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -372,6 +373,12 @@ public boolean matches(T instrument) {
});
}

static class MetricRecorderImpl implements MetricRecorder {
}

static class BatchRecorderImpl implements BatchRecorder {
}

static class TestlogHandler extends Handler {
List<LogRecord> logs = new ArrayList<>();

Expand Down

0 comments on commit 0de7bfe

Please sign in to comment.