-
Notifications
You must be signed in to change notification settings - Fork 3
Reporters
Allan Hardy edited this page Aug 7, 2016
·
5 revisions
Metrics reports can be configured using the MetricsOptions class in your startup.cs
Example using the InfluxDB Reporter, you can than plug this in as a datasource in Grafana to plot all your metrics as shown below the code sample.
See here for more details on Metrics.NET reporters
public void ConfigureServices(IServiceCollection services)
{
services
.AddLogging()
.AddRouting(options => { options.LowercaseUrls = true; });
services.AddMvc(options =>
{
options.Filters.Add(new MetricsResourceFilter(new DefaultRouteTemplateResolver()));
});
services
.AddMetrics(options =>
{
options.MetricsVisualisationEnabled = false;
})
.AddAllPerforrmanceCounters()
.AddHealthChecks()
.AddReporter(reporter =>
{
reporter.WithInflux("127.0.0.1", 8086, "{db_username}", "{db_password}", "{db_name}", TimeSpan.FromSeconds(5));
});
}