/// <summary> /// Add the <see cref="MetricsGraphitePlainTextProtocolOutputFormatter" /> allowing metrics to optionally be reported to /// Graphite using the Plain Text Protocol. /// </summary> /// <param name="metricFormattingBuilder">s /// The <see cref="IMetricsOutputFormattingBuilder" /> used to configure InfluxDB Lineprotocol formatting /// options. /// </param> /// <param name="setupAction">The InfluxDB LineProtocol formatting options to use.</param> /// <param name="fields">The metric fields to report as well as thier names.</param> /// <returns> /// An <see cref="IMetricsBuilder" /> that can be used to further configure App Metrics. /// </returns> public static IMetricsBuilder AsGraphitePlainTextProtocol( this IMetricsOutputFormattingBuilder metricFormattingBuilder, Action <MetricsGraphitePlainTextProtocolOptions> setupAction, MetricFields fields = null) { if (metricFormattingBuilder == null) { throw new ArgumentNullException(nameof(metricFormattingBuilder)); } if (setupAction == null) { throw new ArgumentNullException(nameof(setupAction)); } var options = new MetricsGraphitePlainTextProtocolOptions(); setupAction.Invoke(options); if (fields == null) { fields = new MetricFields(); fields.DefaultGraphiteMetricFieldNames(); } var formatter = new MetricsGraphitePlainTextProtocolOutputFormatter(options, fields); return(metricFormattingBuilder.Using(formatter, false)); }
/// <summary> /// Add the <see cref="MetricsGraphitePlainTextProtocolOutputFormatter" /> allowing metrics to optionally be reported to /// Graphite using the Plain Text Protocol. /// </summary> /// <param name="metricFormattingBuilder">s /// The <see cref="IMetricsOutputFormattingBuilder" /> used to configure InfluxDB Lineprotocol formatting /// options. /// </param> /// <returns> /// An <see cref="IMetricsBuilder" /> that can be used to further configure App Metrics. /// </returns> public static IMetricsBuilder AsGraphitePlainTextProtocol(this IMetricsOutputFormattingBuilder metricFormattingBuilder) { if (metricFormattingBuilder == null) { throw new ArgumentNullException(nameof(metricFormattingBuilder)); } var formatter = new MetricsGraphitePlainTextProtocolOutputFormatter(); return(metricFormattingBuilder.Using(formatter, false)); }
/// <summary> /// Add the <see cref="MetricsHostedMetricsJsonOutputFormatter" /> allowing metrics to optionally be reported to /// GrafanaCloud Hosted Metrics Graphite syntax. /// </summary> /// <param name="metricFormattingBuilder">s /// The <see cref="IMetricsOutputFormattingBuilder" /> used to configure GrafanaCloud Hosted Metrics formatting /// options. /// </param> /// <returns> /// An <see cref="IMetricsBuilder" /> that can be used to further configure App Metrics. /// </returns> public static IMetricsBuilder AsGrafanaCloudHostedMetricsGraphiteSyntax(this IMetricsOutputFormattingBuilder metricFormattingBuilder) { if (metricFormattingBuilder == null) { throw new ArgumentNullException(nameof(metricFormattingBuilder)); } var formatter = new MetricsHostedMetricsJsonOutputFormatter(); return(metricFormattingBuilder.Using(formatter, false)); }
/// <summary> /// Add the <see cref="MetricsPrometheusFormatterBuilder" /> allowing metrics to optionally be formatted in Prometheus plain text format /// </summary> /// <param name="metricFormattingBuilder">s /// The <see cref="IMetricsOutputFormattingBuilder" /> used to configure Prometheus formatting /// options. /// </param> /// <returns> /// An <see cref="IMetricsBuilder" /> that can be used to further configure App Metrics. /// </returns> public static IMetricsBuilder AsPrometheusPlainText( this IMetricsOutputFormattingBuilder metricFormattingBuilder) { if (metricFormattingBuilder == null) { throw new ArgumentNullException(nameof(metricFormattingBuilder)); } var formatter = new MetricsPrometheusTextOutputFormatter(); return(metricFormattingBuilder.Using(formatter, false)); }
/// <summary> /// Add the <see cref="MetricsInfluxDbLineProtocolOutputFormatter" /> allowing metrics to optionally be reported to /// InfluxDB using the LineProtocol. /// </summary> /// <param name="metricFormattingBuilder">s /// The <see cref="IMetricsOutputFormattingBuilder" /> used to configure InfluxDB Lineprotocol formatting /// options. /// </param> /// <param name="fields">The metric fields to report as well as thier names.</param> /// <returns> /// An <see cref="IMetricsBuilder" /> that can be used to further configure App Metrics. /// </returns> public static IMetricsBuilder AsInfluxDbLineProtocol( this IMetricsOutputFormattingBuilder metricFormattingBuilder, MetricFields fields = null) { if (metricFormattingBuilder == null) { throw new ArgumentNullException(nameof(metricFormattingBuilder)); } var formatter = new MetricsInfluxDbLineProtocolOutputFormatter(fields); return(metricFormattingBuilder.Using(formatter, false)); }
/// <summary> /// Add the <see cref="MetricsPrometheusFormatterBuilder" /> allowing metrics to optionally be formatted in Prometheus protobuf format /// </summary> /// <param name="metricFormattingBuilder">s /// The <see cref="IMetricsOutputFormattingBuilder" /> used to configure Prometheus formatting /// options. /// </param> /// <param name="options">The Prometheus formatting options to use.</param> /// <returns> /// An <see cref="IMetricsBuilder" /> that can be used to further configure App Metrics. /// </returns> public static IMetricsBuilder AsPrometheusProtobuf( this IMetricsOutputFormattingBuilder metricFormattingBuilder, MetricsPrometheusOptions options) { if (metricFormattingBuilder == null) { throw new ArgumentNullException(nameof(metricFormattingBuilder)); } var formatter = new MetricsPrometheusProtobufOutputFormatter(options); return(metricFormattingBuilder.Using(formatter, false)); }
/// <summary> /// Add the <see cref="MetricsDatadogJsonOutputFormatter" /> allowing metrics to optionally be reported to Datadog /// </summary> /// <param name="metricFormattingBuilder">s /// The <see cref="IMetricsOutputFormattingBuilder" /> used to configure Datadog formatting /// options. /// </param> /// <param name="flushInterval">Interval is required my hosted metrics.</param> /// <param name="fields">The metric fields to report as well as their names.</param> /// <returns> /// An <see cref="IMetricsBuilder" /> that can be used to further configure App Metrics. /// </returns> public static IMetricsBuilder AsDatadogJson( this IMetricsOutputFormattingBuilder metricFormattingBuilder, TimeSpan flushInterval, MetricFields fields = null) { if (metricFormattingBuilder == null) { throw new ArgumentNullException(nameof(metricFormattingBuilder)); } var formatter = new MetricsDatadogJsonOutputFormatter(flushInterval, fields); return(metricFormattingBuilder.Using(formatter, false)); }
/// <summary> /// Add the <see cref="MetricsStatsDStringOutputFormatter" /> allowing metrics to optionally be reported to Datadog /// </summary> /// <param name="metricFormattingBuilder"> /// The <see cref="IMetricsOutputFormattingBuilder" /> used to configure Datadog formatting /// options. /// </param> /// <param name="options">The Datadog formatting options to use.</param> /// <param name="fields">The metric fields to report as well as their names.</param> /// <returns> /// An <see cref="IMetricsBuilder" /> that can be used to further configure App Metrics. /// </returns> public static IMetricsBuilder AsStatsDString( this IMetricsOutputFormattingBuilder metricFormattingBuilder, MetricsStatsDOptions options, MetricFields fields = null) { if (metricFormattingBuilder == null) { throw new ArgumentNullException(nameof(metricFormattingBuilder)); } var formatter = new MetricsStatsDStringOutputFormatter(options, fields); return(metricFormattingBuilder.Using(formatter, false)); }
/// <summary> /// Add the <see cref="MetricsHostedMetricsJsonOutputFormatter" /> allowing metrics to optionally be reported to /// GrafanaCloud Hosted Metrics Graphite syntax. /// </summary> /// <param name="metricFormattingBuilder">s /// The <see cref="IMetricsOutputFormattingBuilder" /> used to configure GrafanaCloud Hosted Metrics formatting /// options. /// </param> /// <param name="options">The GrafanaCloud Hosted Metrics formatting options to use.</param> /// <param name="flushInterval">Interval is required my hosted metrics.</param> /// <param name="fields">The metric fields to report as well as their names.</param> /// <returns> /// An <see cref="IMetricsBuilder" /> that can be used to further configure App Metrics. /// </returns> public static IMetricsBuilder AsGrafanaCloudHostedMetricsGraphiteSyntax( this IMetricsOutputFormattingBuilder metricFormattingBuilder, MetricsHostedMetricsOptions options, TimeSpan flushInterval, MetricFields fields = null) { if (metricFormattingBuilder == null) { throw new ArgumentNullException(nameof(metricFormattingBuilder)); } var formatter = new MetricsHostedMetricsJsonOutputFormatter(flushInterval, options, fields); return(metricFormattingBuilder.Using(formatter, false)); }
/// <summary> /// Add the <see cref="MetricsJsonOutputFormatter" /> allowing metrics to optionally be reported as JSON. /// </summary> /// <param name="metricFormattingBuilder"> /// The <see cref="IMetricsOutputFormattingBuilder" /> used to configure JSON formatting /// options. /// </param> /// <param name="setupAction">The JSON formatting options to use.</param> /// <returns> /// An <see cref="IMetricsBuilder" /> that can be used to further configure App Metrics. /// </returns> public static IMetricsBuilder AsJson( this IMetricsOutputFormattingBuilder metricFormattingBuilder, Action <MetricsJsonOptions> setupAction = null) { if (metricFormattingBuilder == null) { throw new ArgumentNullException(nameof(metricFormattingBuilder)); } var options = new MetricsJsonOptions(); setupAction?.Invoke(options); var formatter = new MetricsJsonOutputFormatter(options.SerializerSettings); return(metricFormattingBuilder.Using(formatter)); }
/// <summary> /// Add the <see cref="MetricsInfluxDbLineProtocolOutputFormatter" /> allowing metrics to optionally be reported to /// InfluxDB using the LineProtocol. /// </summary> /// <param name="metricFormattingBuilder">s /// The <see cref="IMetricsOutputFormattingBuilder" /> used to configure InfluxDB Lineprotocol formatting /// options. /// </param> /// <param name="setupAction">The InfluxDB LineProtocol formatting options to use.</param> /// <param name="fields">The metric fields to report as well as thier names.</param> /// <returns> /// An <see cref="IMetricsBuilder" /> that can be used to further configure App Metrics. /// </returns> public static IMetricsBuilder AsInfluxDbLineProtocol( this IMetricsOutputFormattingBuilder metricFormattingBuilder, Action <MetricsInfluxDbLineProtocolOptions> setupAction, MetricFields fields = null) { if (metricFormattingBuilder == null) { throw new ArgumentNullException(nameof(metricFormattingBuilder)); } var options = new MetricsInfluxDbLineProtocolOptions(); setupAction?.Invoke(options); var formatter = new MetricsInfluxDbLineProtocolOutputFormatter(options, fields); return(metricFormattingBuilder.Using(formatter, false)); }
/// <summary> /// Add the <see cref="MetricsTextOutputFormatter" /> allowing metrics to optionally be reported as plain text. /// </summary> /// <param name="metricFormattingBuilder"> /// The <see cref="IMetricsOutputFormattingBuilder" /> used to configure formatting /// options. /// </param> /// <param name="setupAction">The plain text formatting options to use.</param> /// <param name="metricFields">The metric fields to output as well as their names. This will override the globally configured metric fields.</param> /// <returns> /// An <see cref="IMetricsBuilder" /> that can be used to further configure App Metrics. /// </returns> public static IMetricsBuilder AsPlainText( this IMetricsOutputFormattingBuilder metricFormattingBuilder, Action <MetricsTextOptions> setupAction = null, MetricFields metricFields = null) { if (metricFormattingBuilder == null) { throw new ArgumentNullException(nameof(metricFormattingBuilder)); } var options = new MetricsTextOptions(); setupAction?.Invoke(options); var formatter = new MetricsTextOutputFormatter(options) { MetricFields = metricFields }; return(metricFormattingBuilder.Using(formatter)); }
/// <summary> /// Add the <see cref="MetricsHostedMetricsJsonOutputFormatter" /> allowing metrics to optionally be reported to /// GrafanaCloud Hosted Metrics Graphite syntax. /// </summary> /// <param name="metricFormattingBuilder">s /// The <see cref="IMetricsOutputFormattingBuilder" /> used to configure GrafanaCloud Hosted Metrics formatting /// options. /// </param> /// <param name="setupAction">The GrafanaCloud Hosted Metrics formatting options to use.</param> /// <returns> /// An <see cref="IMetricsBuilder" /> that can be used to further configure App Metrics. /// </returns> public static IMetricsBuilder AsGrafanaCloudHostedMetricsGraphiteSyntax( this IMetricsOutputFormattingBuilder metricFormattingBuilder, Action <MetricsHostedMetricsOptions> setupAction) { if (metricFormattingBuilder == null) { throw new ArgumentNullException(nameof(metricFormattingBuilder)); } if (setupAction == null) { throw new ArgumentNullException(nameof(setupAction)); } var options = new MetricsHostedMetricsOptions(); setupAction.Invoke(options); var formatter = new MetricsHostedMetricsJsonOutputFormatter(options); return(metricFormattingBuilder.Using(formatter, false)); }
/// <summary> /// Add the <see cref="MetricsPrometheusFormatterBuilder" /> allowing metrics to optionally be formatted in Prometheus plain text format /// </summary> /// <param name="metricFormattingBuilder">s /// The <see cref="IMetricsOutputFormattingBuilder" /> used to configure Prometheus formatting /// options. /// </param> /// <param name="setupAction">The Prometheus formatting options to use.</param> /// <returns> /// An <see cref="IMetricsBuilder" /> that can be used to further configure App Metrics. /// </returns> public static IMetricsBuilder AsPrometheusPlainText( this IMetricsOutputFormattingBuilder metricFormattingBuilder, Action <MetricsPrometheusOptions> setupAction) { if (metricFormattingBuilder == null) { throw new ArgumentNullException(nameof(metricFormattingBuilder)); } if (setupAction == null) { throw new ArgumentNullException(nameof(setupAction)); } var options = new MetricsPrometheusOptions(); setupAction.Invoke(options); var formatter = new MetricsPrometheusTextOutputFormatter(options); return(metricFormattingBuilder.Using(formatter, false)); }
/// <summary> /// Add the <see cref="MetricsDatadogJsonOutputFormatter" /> allowing metrics to optionally be reported to Datadog /// </summary> /// <param name="metricFormattingBuilder">s /// The <see cref="IMetricsOutputFormattingBuilder" /> used to configure Datadog formatting /// options. /// </param> /// <param name="setupAction">The Datadog formatting options to use.</param> /// <param name="flushInterval">Interval is required my hosted metrics.</param> /// <param name="fields">The metric fields to report as well as their names.</param> /// <returns> /// An <see cref="IMetricsBuilder" /> that can be used to further configure App Metrics. /// </returns> public static IMetricsBuilder AsDatadogJson( this IMetricsOutputFormattingBuilder metricFormattingBuilder, Action <MetricsDatadogOptions> setupAction, TimeSpan flushInterval, MetricFields fields = null) { if (metricFormattingBuilder == null) { throw new ArgumentNullException(nameof(metricFormattingBuilder)); } if (setupAction == null) { throw new ArgumentNullException(nameof(setupAction)); } var options = new MetricsDatadogOptions(); setupAction.Invoke(options); var formatter = new MetricsDatadogJsonOutputFormatter(flushInterval, options, fields); return(metricFormattingBuilder.Using(formatter, false)); }