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

HTTP Reporter

Metrics can be reported to a custom http endpoint using the App.Metrics.Extensions.Reporting.Http nuget package.

  1. First see the getting started guide.
  2. Configure the HTTP reporter as follows:
.AddReporting(factory =>
{
    factory.AddHttp(
        new HttpReporterSettings
        {
            // Set the endpoint where metrics should be posted
            HttpSettings = new HttpSettings(new Uri("http://localhost/metrics-receive")),
            ReportInterval = TimeSpan.FromSeconds(5),
            HttpPolicy = new HttpPolicy
                        {                            
                            // The number of http failures to cause a backoff in reporting
                            FailuresBeforeBackoff = 5, 
                            // Duration to backoff if the number of http failures have been reached
                            BackoffPeriod = TimeSpan.FromSeconds(30), 
                            // Timeout of the underlaying HTTP call
                            Timeout = TimeSpan.FromSeconds(3) 
                        }
        },
        // Formats the metrics before sending over HTTP
        new AsciiMetricPayloadBuilder());
})
Tip

The example above is using the AsciiMetricPayloadBuilder, this can be substituted with with any of the InfluxDB, Elasticsearch, Prometheus, Graphite, App Metrics JSON, or a custom payload builder.

  • Edit this Doc
Back to top Copyright © 2017 Allan Hardy
Generated by DocFX