Skip to content

Commit 4d59769

Browse files
authored
fix(spanner): enable afe_connectivity_error_count metric (#7964)
enable AFE connectivity metric. This was disabled as part of https://togithub.com/googleapis/nodejs-spanner/pull/2417
1 parent 31a7ec9 commit 4d59769

3 files changed

Lines changed: 10 additions & 4 deletions

File tree

handwritten/spanner/src/metrics/interceptor.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,7 @@ export const MetricInterceptor = (options, nextCall) => {
7575
if (metricsTracer?.afeLatency) {
7676
metricsTracer?.recordAfeLatency(status.code);
7777
} else {
78-
// Disable afe_connectivity_error_count metric as AFE header is disabled in backend
79-
// currently.
80-
// metricsTracer?.recordAfeConnectivityErrorCount(status.code);
78+
metricsTracer?.recordAfeConnectivityErrorCount(status.code);
8179
}
8280
},
8381
};

handwritten/spanner/test/metrics/interceptor.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ describe('MetricInterceptor', () => {
197197
);
198198
});
199199

200-
it.skip('AFE Metrics - Connectivity Error Count', () => {
200+
it('AFE Metrics - Connectivity Error Count', () => {
201201
const interceptingCall = MetricInterceptor(mockOptions, mockNextCall);
202202
interceptingCall.start(testMetadata, mockListener);
203203

handwritten/spanner/test/metrics/metrics.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -458,6 +458,10 @@ describe('Test metrics with mock server', () => {
458458
resourceMetrics,
459459
METRIC_NAME_GFE_CONNECTIVITY_ERROR_COUNT,
460460
);
461+
const afeConnectivityErrorCountData = getMetricData(
462+
resourceMetrics,
463+
METRIC_NAME_AFE_CONNECTIVITY_ERROR_COUNT,
464+
);
461465

462466
// Verify GFE AFE latency doesn't exist
463467
assert.ok(!hasMetricData(resourceMetrics, METRIC_NAME_GFE_LATENCIES));
@@ -483,6 +487,10 @@ describe('Test metrics with mock server', () => {
483487
getAggregatedValue(connectivityErrorCountData, attributes),
484488
1,
485489
);
490+
assert.strictEqual(
491+
getAggregatedValue(afeConnectivityErrorCountData, attributes),
492+
1,
493+
);
486494
});
487495
});
488496

0 commit comments

Comments
 (0)