/// <summary> /// Adds a Bosun endpoint to the collector. /// </summary> public static IMetricsCollectorBuilder AddBosunEndpoint(this IMetricsCollectorBuilder builder, Uri baseUri, Action <BosunMetricHandler> configure = null) { var handler = new BosunMetricHandler(baseUri); configure?.Invoke(handler); return(builder.AddEndpoint("Bosun", handler)); }
/// <summary> /// Adds a SignalFx endpoint to the collector. /// </summary> public static IMetricsCollectorBuilder AddSignalFxEndpoint(this IMetricsCollectorBuilder builder, Uri baseUri, string accessToken, Action <SignalFxMetricHandler> configure = null) { var handler = new SignalFxMetricHandler(baseUri, accessToken); configure?.Invoke(handler); return(builder.AddEndpoint("SignalFx", handler)); }
/// <summary> /// Adds the default built-in <see cref="IMetricSet" /> implementations to the collector. /// </summary> public static IMetricsCollectorBuilder AddDefaultSets(this IMetricsCollectorBuilder builder) { return(builder.AddProcessMetricSet() #if NETCOREAPP .AddAspNetMetricSet() .AddRuntimeMetricSet() #endif ); }
/// <summary> /// Removes any <see cref="MetricSource"/> instances registered for the collector. /// </summary> public static IMetricsCollectorBuilder ClearSources(this IMetricsCollectorBuilder builder) { builder.Services.RemoveAll <MetricSource>(); for (var i = builder.Services.Count - 1; i >= 0; i--) { if (builder.Services[i].ServiceType.IsSubclassOf(typeof(MetricSource))) { builder.Services.RemoveAt(i); } } return(builder); }
/// <summary> /// Adds an <see cref="IMetricSet" /> to the collector. /// </summary> public static IMetricsCollectorBuilder AddSet <T>(this IMetricsCollectorBuilder builder, T set) where T : class, IMetricSet { builder.Services.AddTransient <IMetricSet>(_ => set); return(builder); }
/// <summary> /// Exceptions which occur on a background thread will be passed to the delegate specified here. /// </summary> public static IMetricsCollectorBuilder UseExceptionHandler(this IMetricsCollectorBuilder builder, Action <Exception> handler) { builder.Options.ExceptionHandler = handler; return(builder); }
/// <summary> /// Adds a <see cref="AspNetMetricSet" /> to the collector. /// </summary> public static IMetricsCollectorBuilder AddAspNetMetricSet(this IMetricsCollectorBuilder builder) => builder.AddSet <AspNetMetricSet>();
/// <summary> /// Adds a <see cref="RuntimeMetricSet" /> to the collector. /// </summary> public static IMetricsCollectorBuilder AddRuntimeMetricSet(this IMetricsCollectorBuilder builder) => builder.AddSet <RuntimeMetricSet>();
/// <summary> /// Adds a <see cref="ProcessMetricSet" /> to the collector. /// </summary> public static IMetricsCollectorBuilder AddProcessMetricSet(this IMetricsCollectorBuilder builder) => builder.AddSet <ProcessMetricSet>();