-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixed the EWMA to work regardless of the TICK_THREAD interval settings in #6
Conversation
…s in e.g. MeterMetric. Before this fix, an EWMA was always created with a default interval of 5 seconds which gave incorrect results when createing a MeterMetric with different values (for interval and intervalUnit). The following simple test now gives (aproximaapproximately) the same output: MeterMetric meter = MeterMetric.newMeter(1, TimeUnit.SECONDS, "test event", TimeUnit.SECONDS); for (int i = 0; i < 100; i++) { Thread.sleep(100); meter.mark(); } System.out.println(meter.meanRate()); System.out.println(meter.oneMinuteRate());
Fixed in 37f88c1 instead, by removing the second factory method and disallowing arbitrary intervals. |
Ok, Thank you. We are currently evaluating the Metrics lib in favor to our own (much similar). But to feel confident we need the per sec counter :-) Great work btw! /Jesper On 15 apr 2011, at 05:59, codahalereply@reply.github.com wrote:
|
I think you may be misunderstanding what the interval is vs. what the rate unit is. The interval is the interval between ticks for the exponentially weighted moving averages. This is no longer a public value because it's an implementation detail, not a meaningful external value. The rate unit is the unit of time that events are averaged over (for example requests/second). If you want req/sec, create a meter with a rate unit of TimeUnit.SECONDS and mark it each time you process a request. The resulting mean, 1-minute, 5-minute, and 15-minute rates will all be in requests per second. Coda Hale On Thursday, April 14, 2011 at 10:40 PM, jebl01 wrote:
|
Yes, but it will still be a mean value based on the last 1,5,15 minutes, not an actual snapshot of the latest one second, right! /Jesper On 15 apr 2011, at 07:49, codahalereply@reply.github.com wrote:
|
Fixed the EWMA to work regardless of the TICK_THREAD interval settings in e.g. MeterMetric.
Before this fix, an EWMA was always created with a default interval of 5 seconds which gave incorrect
results when createing a MeterMetric with different values (for interval and intervalUnit).
The following simple test now gives (aproximaapproximately) the same output:
MeterMetric meter = MeterMetric.newMeter(1, TimeUnit.SECONDS, "test event", TimeUnit.SECONDS);
for (int i = 0; i < 100; i++)
{
Thread.sleep(100);
meter.mark();
}
System.out.println(meter.meanRate());
System.out.println(meter.oneMinuteRate());