etishor / Metrics.NET

The Metrics.NET library provides a way of instrumenting applications with custom metrics (timers, histograms, counters etc) that can be reported in various ways and can provide insights on what is happening inside a running application.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

MetricsContext changes caused metrics to be group under one label

alhardy opened this issue · comments

After merging latest changes with fork, I noticed in the owin sample that request metrics are now not calculated per endpoint but they are grouped in under the one label.

This appears to have happened after the changes made around swapping out MetricsRegistry with MetricsContext. Could you direct me how to resolve this? Also how can MetricsContext be used to group metrics, do we have any documentation/tests on this?

Thanks.

@alhardy The "context" related changes are not yet finalized. The core part is almost complete, I just need to test a few scenarios and maybe tune things a bit. The adapters part still needs to be changed to take advantage of the "contexts" mechanism.

Basically the idea is that and adapter (NancyFx, OWIN) should add a child context to the global context and add all the pre-defined metrics to the child context. Or better yet, allow the user at config time to select the context where the adapter will add the child context.

I've done some of the changes to the NancyFx adapter, but i'm hoping to finish it this week.

Anyway, most of the changes are at configuration level, the existing metrics will remain unchanged.

I'll post more updates as I will make some progress, but as usual day job gets in the way of everything :)

OK thanks for the update. I'm happy to update the OWIN adaptor if that helps once your done with NancyFx so I can use this as an example?

@alhardy i've updated the OWIN adapter also to be consistent with the nancy adapter. I've made the most common config (with all metrics and with metrics endpoint) as the default config - Metrics.Config.WithOwin(m=>app.Use(m))

Please take a look at it and see you spot any potential issues. I've run the sample and a few tests and it looks good.

Also let me know if you think things can me made more clear when configuring / extending Metrics.NET