Awesome Open Source
Awesome Open Source


Metrics is a framework for reporting data point information (measurements and time-series) for .NET applications, uncompromisingly simple.

Metrics can also be used as a .NET client for Graphite.


  • We currently support the following targets out of the box:
    • Graphite
    • Console
    • In-momeory (for tests)
  • .Net Core support - targeting .Net Standard 1.6

Getting started



Start Reporting Metrics

To start reporting metrics on an application, just call MetricsStarter.Initialize with the required reporters, on the application startup:

    new GraphiteMetricsReporterFactory(_graphiteConfiguration),
    new ConsoleMetricsReporterFactory(0)

Next, to report metrics data, you need to use the static Metrics object, with the required operation. For example:

//first, declare a space:
private MetricsSpace _metrics = Metrics.Space("Custom").Space("SubSpace").Space("SubSubSpace");

public void SomeMethod()
	//reporting an increment:

	//reporting execution time:
	using (_meter("MeterName").TimeScope())
		// operations to measure...

	//reporting value distribution:

Using Graphite

One of Metric's main targets is Graphite. Graphite is a monitoring tool that applications can report numeric data-points to, and afterwards visualize this data. (more info abour Graphite can be found on Graphite's webstite:

To use Graphite, you will need to implement IGraphiteConfiguration on your application, and pass it to the GraphiteMetricsReporterFactory as shown above.

public class GraphiteConfiguration : IGraphiteConfiguration
	public string IpAddress { get; }

	public GraphiteConfiguration(string ipAddress)
		IpAddress = ipAddress;

Reporting Control

You can turn on/off/suspend the metrics reporting while the application is still running.

Just take dependency on IMetricsSwitch and use the actions it provides. Note that IMetricsSwitch controls all metrics reporters.

There's also a switch for controlling graphite only, with the suprising name - IGraphiteSwitch.


You can customize metrics and take it to a whole new level by creating your own implementation of IMetricsReporterFactory.

Implement the CreateReporter Method, and register it to MetricsStarter.Initialize, along with all other out-of-the-box reporters.

For example, this is basically how our beloved PerfDbg works... it's based on metrics reporting:

public class PerfDbgReporterFactory : IMetricsReporterFactory
	public Action<DataPoint> CreateReporter()
		return PerfDbgReporter.Report;


How to contribute

We encorage contribution via pull requests on any feature you see fit.

When submitting a pull request make sure to do the following:

  • Check that new and updated code follows OhioBox existing code formatting and naming standard
  • Run all tests to ensure no existing functionality has been affected
  • Write tests to test your changes. All features and fixed bugs must have tests to verify they work. Read GitHub Help for more details about creating pull requests

Running tests

You can simply run the tests in Visual Studio or with NUnit test runner.

Get A Weekly Email With Trending Projects For These Topics
No Spam. Unsubscribe easily at any time.
c-sharp (12,637
csharp (1,121
dotnet (916
graphite (55
performance-metrics (43