[英]Making a Minute Rate Metric in Netflix Servo
I want to convert the StepCounter from doing the rates based on seconds to rate per minute (we have a monitor that runs every minute). 我想将StepCounter从基于秒的速率转换为每分钟速率(我们有一台每分钟运行一次的监视器)。
When I try to switch them polling from 1 per second to once every 60 seconds, it will, instead, take the increment value and divide it by 60 and create an rate per second. 当我尝试将轮询从每秒1次切换到每60秒一次时,它将采用增量值并将其除以60并创建每秒速率。
Anyone have an idea of how to expose a JMX value via Netflix Servo package to do a 60s metric instead? 任何人都知道如何通过Netflix Servo软件包公开JMX值来代替60s指标? There's CounterToRateMetricTransform but there are no examples on how to convert a Counter metric to a Rate.
有CounterToRateMetricTransform,但没有关于如何将Counter度量转换为Rate的示例。
StepCounter is an individual metric, but CounterToRateMetricTransform is applied to a MetricObserver, and returns a new observer that observes all counters transformed as rates StepCounter是一个单独的度量标准,但CounterToRateMetricTransform应用于MetricObserver,并返回一个新的观察者,该观察者观察转换为率的所有计数器
eg to create an observer that observes counters as rates and add it to a pollrunnable task 例如,创建一个观察者,将计数器视为速率并将其添加到可轮询的任务中
MetricObserver observer = new CloudWatchMetricObserver(...) // existing observer
MetricObserver transformedObserver = new CounterToRateMetricTransform(observer, 60, TimeUnit.SECONDS);
PollRunnable task = new PollRunnable(..., Immutable.listOf(transformedObserver));
Unfortunately this transform also returns a rate per second (see CounterToRateMetricTransform.computeRate) 不幸的是,此变换还返回每秒的速率(请参阅CounterToRateMetricTransform.computeRate)
There's no way to get a per minute rate through the existing library as far as I can see, you'd need to either implement your own metric (like StepCounter) or your own transform on an observer (like CounterToRateMetricTransform) depending on your use case. 就我所见,你无法通过现有的库获得每分钟的速率,你需要实现自己的度量(如StepCounter)或你自己的观察者转换(如CounterToRateMetricTransform),具体取决于你的用例。
The best approach is probably just to take the per second rate and multiply it by 60 in your monitoring system rather than changing the reporting 最好的方法可能只是采用每秒速率并在监控系统中乘以60而不是更改报告
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.