Skip to content

Commit 9366622

Browse files
committed
xds: improve test coverage for ExternalProcessorClientInterceptor
Remove redundant isCompleted check from isSidecarReady and null checks from recordDuration. TAG=agy CONV=9ea901ca-a127-468c-a836-414f2154bf85
1 parent e9a8c2b commit 9366622

1 file changed

Lines changed: 6 additions & 11 deletions

File tree

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

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -368,14 +368,12 @@ private void activateCall() {
368368
}
369369

370370
private void recordDuration(DoubleHistogramMetricInstrument instrument, long durationNanos) {
371-
if (instrument != null) {
372-
double durationSecs = (double) durationNanos / 1_000_000_000.0;
373-
metricsRecorder.recordDoubleHistogram(
374-
instrument,
375-
durationSecs,
376-
ImmutableList.of(target),
377-
ImmutableList.of(backendService));
378-
}
371+
double durationSecs = (double) durationNanos / 1_000_000_000.0;
372+
metricsRecorder.recordDoubleHistogram(
373+
instrument,
374+
durationSecs,
375+
ImmutableList.of(target),
376+
ImmutableList.of(backendService));
379377
}
380378

381379
/**
@@ -733,9 +731,6 @@ private void onReadyNotify() {
733731

734732
private boolean isSidecarReady() {
735733
ExtProcStreamState state = extProcStreamState.get();
736-
if (state.isCompleted()) {
737-
return true;
738-
}
739734
if (state.isDraining()) {
740735
return false;
741736
}

0 commit comments

Comments
 (0)