Skip to content
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

Multidimensional metrics are sharing same reservoir when changed from default #107

Closed
Rurouni opened this issue Mar 28, 2017 · 1 comment
Labels
Projects
Milestone

Comments

@Rurouni
Copy link

Rurouni commented Mar 28, 2017

Repro:

var services = new ServiceCollection();
services.AddLogging();
services.AddOptions();
services.AddMetrics();
var metrics = services.BuildServiceProvider().GetService<IMetrics>();

var timerDef = new TimerOptions()
{
    Reservoir = new Lazy<IReservoir>(() => new DefaultForwardDecayingReservoir())
};
var timer1 = metrics.Provider.Timer.Instance(timerDef, new MetricTags("test", "1"));
var timer2 = metrics.Provider.Timer.Instance(timerDef, new MetricTags("test", "2"));

timer1.Record(100, TimeUnit.Seconds);
timer1.Record(100, TimeUnit.Seconds);
timer1.Record(100, TimeUnit.Seconds);
timer1.Record(100, TimeUnit.Seconds);
timer1.Record(100, TimeUnit.Seconds);

var timers = metrics.Snapshot.Get().Contexts.First().Timers.ToArray();

Assert.Equal(5, timers[0].Value.Histogram.Count);
Assert.Equal(100_000, timers[0].Value.Histogram.Mean);

Assert.Equal(0, timers[1].Value.Histogram.Mean);
Assert.Equal(0, timers[1].Value.Histogram.Count);

Full project with that test:
AppMetricsBug.zip

@alhardy alhardy added this to the 1.1.0-alpha milestone Mar 28, 2017
@alhardy alhardy added this to TODO in 1.1.0-alpha Mar 28, 2017
@alhardy alhardy moved this from TODO to In Progress in 1.1.0-alpha Mar 29, 2017
@alhardy alhardy added the bug label Apr 2, 2017
@alhardy alhardy moved this from In Progress to Needs Testing in 1.1.0-alpha Apr 2, 2017
@alhardy
Copy link
Collaborator

alhardy commented Apr 2, 2017

@alhardy alhardy moved this from Needs Testing to Ready for Release in 1.1.0-alpha Apr 11, 2017
@alhardy alhardy closed this as completed Apr 11, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
No open projects
1.1.0-alpha
Ready for Release
Development

No branches or pull requests

2 participants