return Gauge.builder(CM_HANDLE_STATE_GAUGE, cmHandlesByState,
value -> cmHandlesByState.get("advisedCmHandlesCount"))
.tag(STATE_TAG, "ADVISED")
- .description("Current number of cmhandles in advised state")
+ .description("Current number of cm handles in advised state")
.register(meterRegistry);
}
return Gauge.builder(CM_HANDLE_STATE_GAUGE, cmHandlesByState,
value -> cmHandlesByState.get("readyCmHandlesCount"))
.tag(STATE_TAG, "READY")
- .description("Current number of cmhandles in ready state")
+ .description("Current number of cm handles in ready state")
.register(meterRegistry);
}
return Gauge.builder(CM_HANDLE_STATE_GAUGE, cmHandlesByState,
value -> cmHandlesByState.get("lockedCmHandlesCount"))
.tag(STATE_TAG, "LOCKED")
- .description("Current number of cmhandles in locked state")
+ .description("Current number of cm handles in locked state")
.register(meterRegistry);
}
return Gauge.builder(CM_HANDLE_STATE_GAUGE, cmHandlesByState,
value -> cmHandlesByState.get("deletingCmHandlesCount"))
.tag(STATE_TAG, "DELETING")
- .description("Current number of cmhandles in deleting state")
+ .description("Current number of cm handles in deleting state")
+ .register(meterRegistry);
+ }
+
+ /**
+ * Register gauge metric for cm handles with state 'deleted'.
+ *
+ * @param meterRegistry meter registry
+ * @return cm handle state gauge
+ */
+ @Bean
+ public Gauge deletedCmHandles(final MeterRegistry meterRegistry) {
+ return Gauge.builder(CM_HANDLE_STATE_GAUGE, cmHandlesByState,
+ value -> cmHandlesByState.get("deletedCmHandlesCount"))
+ .tag(STATE_TAG, "DELETED")
+ .description("Number of cm handles that have been deleted since the application started")
.register(meterRegistry);
}
objectUnderTest.readyCmHandles(simpleMeterRegistry)
objectUnderTest.lockedCmHandles(simpleMeterRegistry)
objectUnderTest.deletingCmHandles(simpleMeterRegistry)
+ objectUnderTest.deletedCmHandles(simpleMeterRegistry)
then: 'each state has the correct value when queried'
- ['ADVISED', 'READY', 'LOCKED', 'DELETING'].each { state ->
+ ['ADVISED', 'READY', 'LOCKED', 'DELETING', 'DELETED'].each { state ->
def gaugeValue = simpleMeterRegistry.get('cmHandlesByState').tag('state',state).gauge().value()
assert gaugeValue == 1
}