diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/SessionPool.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/SessionPool.java index fcb87304f6..cc431b52a5 100644 --- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/SessionPool.java +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/SessionPool.java @@ -2370,6 +2370,7 @@ private void initMetricsCollection(MetricRegistry metricRegistry, List labelValuesWithBeingPreparedType = new ArrayList<>(labelValues); labelValuesWithBeingPreparedType.add(NUM_SESSIONS_BEING_PREPARED); + numSessionsInPoolMetric.removeTimeSeries(labelValuesWithBeingPreparedType); numSessionsInPoolMetric.createTimeSeries( labelValuesWithBeingPreparedType, this, @@ -2439,6 +2445,7 @@ public long applyAsLong(SessionPool sessionPool) { List labelValuesWithInUseType = new ArrayList<>(labelValues); labelValuesWithInUseType.add(NUM_IN_USE_SESSIONS); + numSessionsInPoolMetric.removeTimeSeries(labelValuesWithInUseType); numSessionsInPoolMetric.createTimeSeries( labelValuesWithInUseType, this, @@ -2451,6 +2458,7 @@ public long applyAsLong(SessionPool sessionPool) { List labelValuesWithReadType = new ArrayList<>(labelValues); labelValuesWithReadType.add(NUM_READ_SESSIONS); + numSessionsInPoolMetric.removeTimeSeries(labelValuesWithReadType); numSessionsInPoolMetric.createTimeSeries( labelValuesWithReadType, this, @@ -2463,6 +2471,7 @@ public long applyAsLong(SessionPool sessionPool) { List labelValuesWithWriteType = new ArrayList<>(labelValues); labelValuesWithWriteType.add(NUM_WRITE_SESSIONS); + numSessionsInPoolMetric.removeTimeSeries(labelValuesWithWriteType); numSessionsInPoolMetric.createTimeSeries( labelValuesWithWriteType, this,