App Metrics 1.0 Fork me on GitHub
Show / Hide Table of Contents

ASP.NET Core Middleware Graphite Formatting

To serialize metrics in Graphite Plain Text format when /metrics or /metrics-text is requested:

  1. Add the App.Metrics.Formatters.Graphite nuget package to your ASP.NET Core web application.
  2. Configure in your Startup.cs
public class Startup
{
	public void ConfigureServices(IServiceCollection services)
	{
		services.AddMetrics()
			// .AddGraphiteSerialization() - Enables graphite plain text format on the /metrics-text and /metrics endpoints respectively.
			.AddGraphiteMetricsTextSerialization() // Enables graphite plain text format on the /metrics-text endpoint.
			.AddGraphiteMetricsSerialization() // Enables graphite plain text format on the /metrics endpoint.
			.AddAsciiHealthSerialization()
			.AddHealthChecks()
			.AddMetricsMiddleware();
	}

	public void Configure(IApplicationBuilder app, ILoggerFactory loggerFactory)
	{            
		app.UseMetrics();
	}
}
  • Edit this Doc
Back to top Copyright © 2017 Allan Hardy
Generated by DocFX