Update metrics name for better monitor selection in JMX MetricBeanWriter extension (#2976)

This commit is contained in:
garroshh 2022-11-30 19:15:14 +08:00 committed by LearningGp
parent e03444768b
commit 1483669aaf
1 changed files with 4 additions and 3 deletions

View File

@ -66,10 +66,11 @@ public class MetricBeanWriter {
appName = DEFAULT_APP_NAME;
}
long version = System.currentTimeMillis();
// set or update the new value
// set or update the new metric value
for (MetricNode metricNode : map.values()) {
final String mBeanName = "Sentinel:type=" + appName + ",name=\"" + metricNode.getResource()
+"\",classification=\"" + metricNode.getClassification() +"\"";
final String mBeanName = "Sentinel:type=Metric,resource=" + metricNode.getResource()
+",classification=" + metricNode.getClassification()
+",appName=" + appName;
MetricBean metricBean = mBeanRegistry.findMBean(mBeanName);
if (metricBean != null) {
metricBean.setValueFromNode(metricNode);