-
Notifications
You must be signed in to change notification settings - Fork 150
Home
etishor edited this page Sep 22, 2014
·
24 revisions
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.
###Installation
The library and the adapters are available on NuGet:
Install-Package Metrics.NET
Install-Package NancyFx.Metrics
Install-Package Owin.Metrics
###Configuration
using Metrics;
Metric.Config
.WithHttpEndpoint("http://localhost:1234/")
.WithAllCounters()
.WithReporting(config => config
.WithConsoleReport(TimeSpan.FromSeconds(30))
.WithCSVReports(@"c:\temp\reports\", TimeSpan.FromSeconds(10))
.WithTextFileReport(@"C:\temp\reports\metrics.txt", TimeSpan.FromSeconds(10))
);
###App.Config settings
<!-- Completely disable all metrics -->
<add key="Metrics.CompetelyDisableMetrics" value="true"/>
<!-- Equivalent of calling Metric.Config.WithHttpEndpoint("http://localhost:1234/") -->
<add key="Metrics.HttpListener.HttpUriPrefix" value="http://localhost:1234/"/>
<!-- Equivalent of calling
Metric.Config.WithReporting(config =>
config.WithCSVReports(@"..\MetricsCSV\", TimeSpan.FromSeconds(10))
-->
<add key="Metrics.CSV.Path" value="..\MetricsCSV\"/>
<add key="Metrics.CSV.Interval.Seconds" value="10"/>
###Documentation
The sample folder in the repository contains some usage samples.
For any issues please use the GitHub issues. For questions you can also ping me on Twitter ( @etishor ).