@@ -2370,6 +2370,7 @@ private void initMetricsCollection(MetricRegistry metricRegistry, List<LabelValu
23702370
23712371 // The value of a maxSessionsInUse is observed from a callback function. This function is
23722372 // invoked whenever metrics are collected.
2373+ maxInUseSessionsMetric .removeTimeSeries (labelValues );
23732374 maxInUseSessionsMetric .createTimeSeries (
23742375 labelValues ,
23752376 this ,
@@ -2382,6 +2383,7 @@ public long applyAsLong(SessionPool sessionPool) {
23822383
23832384 // The value of a maxSessions is observed from a callback function. This function is invoked
23842385 // whenever metrics are collected.
2386+ maxAllowedSessionsMetric .removeTimeSeries (labelValues );
23852387 maxAllowedSessionsMetric .createTimeSeries (
23862388 labelValues ,
23872389 options ,
@@ -2394,6 +2396,7 @@ public long applyAsLong(SessionPoolOptions options) {
23942396
23952397 // The value of a numWaiterTimeouts is observed from a callback function. This function is
23962398 // invoked whenever metrics are collected.
2399+ sessionsTimeouts .removeTimeSeries (labelValues );
23972400 sessionsTimeouts .createTimeSeries (
23982401 labelValues ,
23992402 this ,
@@ -2404,6 +2407,7 @@ public long applyAsLong(SessionPool sessionPool) {
24042407 }
24052408 });
24062409
2410+ numAcquiredSessionsMetric .removeTimeSeries (labelValues );
24072411 numAcquiredSessionsMetric .createTimeSeries (
24082412 labelValues ,
24092413 this ,
@@ -2414,6 +2418,7 @@ public long applyAsLong(SessionPool sessionPool) {
24142418 }
24152419 });
24162420
2421+ numReleasedSessionsMetric .removeTimeSeries (labelValues );
24172422 numReleasedSessionsMetric .createTimeSeries (
24182423 labelValues ,
24192424 this ,
@@ -2426,6 +2431,7 @@ public long applyAsLong(SessionPool sessionPool) {
24262431
24272432 List <LabelValue > labelValuesWithBeingPreparedType = new ArrayList <>(labelValues );
24282433 labelValuesWithBeingPreparedType .add (NUM_SESSIONS_BEING_PREPARED );
2434+ numSessionsInPoolMetric .removeTimeSeries (labelValuesWithBeingPreparedType );
24292435 numSessionsInPoolMetric .createTimeSeries (
24302436 labelValuesWithBeingPreparedType ,
24312437 this ,
@@ -2439,6 +2445,7 @@ public long applyAsLong(SessionPool sessionPool) {
24392445
24402446 List <LabelValue > labelValuesWithInUseType = new ArrayList <>(labelValues );
24412447 labelValuesWithInUseType .add (NUM_IN_USE_SESSIONS );
2448+ numSessionsInPoolMetric .removeTimeSeries (labelValuesWithInUseType );
24422449 numSessionsInPoolMetric .createTimeSeries (
24432450 labelValuesWithInUseType ,
24442451 this ,
@@ -2451,6 +2458,7 @@ public long applyAsLong(SessionPool sessionPool) {
24512458
24522459 List <LabelValue > labelValuesWithReadType = new ArrayList <>(labelValues );
24532460 labelValuesWithReadType .add (NUM_READ_SESSIONS );
2461+ numSessionsInPoolMetric .removeTimeSeries (labelValuesWithReadType );
24542462 numSessionsInPoolMetric .createTimeSeries (
24552463 labelValuesWithReadType ,
24562464 this ,
@@ -2463,6 +2471,7 @@ public long applyAsLong(SessionPool sessionPool) {
24632471
24642472 List <LabelValue > labelValuesWithWriteType = new ArrayList <>(labelValues );
24652473 labelValuesWithWriteType .add (NUM_WRITE_SESSIONS );
2474+ numSessionsInPoolMetric .removeTimeSeries (labelValuesWithWriteType );
24662475 numSessionsInPoolMetric .createTimeSeries (
24672476 labelValuesWithWriteType ,
24682477 this ,
0 commit comments