Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fix connectivity error count calculation #1632

Merged
merged 2 commits into from
Feb 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,6 @@ class BuiltinMetricsTracer extends BigtableTracer {
private String zone = "global";
private String cluster = "unspecified";

// gfe stats
private AtomicLong gfeMissingHeaders = new AtomicLong(0);

@VisibleForTesting
BuiltinMetricsTracer(
OperationType operationType, SpanName spanName, StatsRecorderWrapper recorder) {
Expand Down Expand Up @@ -208,10 +205,10 @@ public void recordGfeMetadata(@Nullable Long latency, @Nullable Throwable throwa
// zone information
if (latency != null) {
recorder.putGfeLatencies(latency);
recorder.putGfeMissingHeaders(0);
} else {
gfeMissingHeaders.incrementAndGet();
recorder.putGfeMissingHeaders(1);
}
recorder.putGfeMissingHeaders(gfeMissingHeaders.get());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ public void testGfeMetrics() {
// The first time the request was retried, it'll increment missing header counter
verify(statsRecorderWrapper, times(fakeService.getAttemptCounter().get()))
.putGfeMissingHeaders(gfeMissingHeaders.capture());
assertThat(gfeMissingHeaders.getValue()).isEqualTo(1);
assertThat(gfeMissingHeaders.getAllValues()).containsExactly(1L, 0L);

assertThat(status.getAllValues()).containsExactly("UNAVAILABLE", "OK");
assertThat(tableId.getAllValues()).containsExactly(TABLE_ID, TABLE_ID);
Expand Down