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

Visualisation doesn't work when Health and JSON endpoints are moved.

JoelHT-Landmark opened this issue · comments

I want to move the paths for the endpoints to deconflict with other aspects of our web application...

What I've got is

public class WebApp
    {
        public void Configuration(IAppBuilder app)
        {
            Metric.Config
                .WithOwin(middleware => app.Use(middleware), config => config
                    .WithMetricsEndpoint(endpointConfig =>
                    {
                        endpointConfig
                            .MetricsHealthEndpoint(endpoint: "health/json", enabled: true)
                            .MetricsPingEndpoint(endpoint: "health/ping")
                            .MetricsJsonEndpoint(endpoint: "diagnostics/json")
                            .MetricsTextEndpoint(endpoint: "diagnostics/text", enabled:true)
                            .MetricsEndpoint(endpoint: "diagnostics", enabled: true);
                    })
                );
        }
    }

However, whilst the Flot Visualisation is correctly available at /diagnostics, the embedded HTML has not been amended to look at /health/json and /diagnostics/json for its data, and so isn't functional.

I note from the visualisation project, that part of the problem could be fixed with a little bit of extra script being output...

<script>window.metricsEndpoint = 'http://localhost:1234/json';</script>

But the health checks endpoint is hard-coded. :(

+1. I'd like to put all my metrics under "metrics" like so:

.WithMetricsEndpoint(c =>
    {
        c.MetricsHealthEndpoint(endpoint: "metrics/health")
            .MetricsPingEndpoint(endpoint: "metrics/ping")
            .MetricsJsonEndpoint(endpoint: "metrics/json")
            .MetricsTextEndpoint(endpoint: "metrics/text")
            .MetricsEndpoint(endpoint: "metrics");
    })

As @JoelHT-Landmark suggests, the /metrics page does not update to reflect these new endpoints so this configurability in the middleware is of little use.

We're now using this in anger and it's biting me - if it hurts us enough we'll fork Metrics.Net and fix it ourselves. Not quite there yet tho'

@JoelHT-Landmark I've just hit this issue too, you should probably repost here https://github.com/Recognos/Metrics.NET
as this repo is no longer maintained