简体   繁体   English

为Netflix Servo中的指标提供自定义名称

[英]Providing custom names for for Metrics in Netflix Servo

Currently, when I create a JMX Metric and I register it, the metric's namespace seems to be generated as: 当前,当我创建一个JMX度量标准并注册它时,该度量标准的名称空间似乎生成为:

TYPE.METRIC-NAME.CLASS-NAME.ID

So, a counter metric called "numberOfVisitors" in the class VisitorMetric, registered as VistitorServlet looks like: 因此,在名为VisitorServlet的类VisitorMetric中,称为“ numberOfVisitors”的计数器度量如下所示:

COUNTER.numberOfVisitors.VisitorMetrics.VistitorServlet 

Ideally, I want it named like: 理想情况下,我希望将其命名为:

ID.METRIC-NAME
VistitorServlet.numberOfVisitors

Even if I could reverse it would be better. 即使我可以扭转它会更好。

After some playing around, I figured out a work around: 经过一番游戏后,我想出了一个解决方法:

I created a new tag using the config builder with the key "class" this creates a metric called: 我使用配置构建器通过键“ class”创建了一个新标签,该标签创建了一个度量标准:

COUNTER.[METRIC-NAME].[CLASS-NAME].value COUNTER。[公制-NAME]。[CLASS-NAME]。价值

You can also override the COUNTER in the bean name by creating a new Class - unfortunately, Netflix made the concrete Counter classes final, so you can't just extend and override some functionality of the class. 您还可以通过创建一个新的类来覆盖Bean名称中的COUNTER-不幸的是,Netflix最终将具体的Counter类定为最终类,因此您不能仅仅扩展和覆盖该类的某些功能。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM