Incorrectly enabling/disabling metrics
lasanthaS opened this issue · comments
Description:
On enabling and disabling memory metrics from the SiddhiAppRuntime
, memory metrics are removed and added back to the metrics registry[1][2]. This implementation is incorrect and cause issues when looking up for the metrics by name. Hence instead of removing and adding, metrics level should be set to OFF and other relevant levels.
[1] https://github.com/wso2/carbon-analytics/blob/master/components/org.wso2.carbon.si.metrics.core/src/main/java/org/wso2/carbon/si/metrics/core/SPMemoryUsageMetric.java#L65
[2] https://github.com/wso2/carbon-analytics/blob/master/components/org.wso2.carbon.si.metrics.core/src/main/java/org/wso2/carbon/si/metrics/core/SPMemoryUsageMetric.java#L73
Affected Product Version:
3.0.0-SNAPSHOT
OS, DB, other environment details and versions:
Steps to reproduce:
Refer https://github.com/wso2/carbon-analytics/blob/master/components/org.wso2.carbon.si.metrics.core/src/test/java/org/wso2/carbon/sp/metrics/core/StatisticsTestCase.java