feat(telemetry): MapZbMetrics Prometheus scrape endpoint
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Routing;
|
||||
|
||||
namespace ZB.MOM.WW.Telemetry;
|
||||
|
||||
/// <summary>
|
||||
/// Endpoint extension for mounting the Prometheus <c>/metrics</c> scrape endpoint.
|
||||
/// </summary>
|
||||
public static class ZbMetricsEndpointExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Mounts the Prometheus <c>/metrics</c> endpoint. Only valid when
|
||||
/// <see cref="ZbTelemetryOptions.Exporter"/> = <see cref="ZbExporter.Prometheus"/>.
|
||||
/// Call after <c>app.UseRouting()</c>.
|
||||
/// </summary>
|
||||
/// <param name="endpoints">The endpoint route builder.</param>
|
||||
public static IEndpointConventionBuilder MapZbMetrics(this IEndpointRouteBuilder endpoints)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(endpoints);
|
||||
return endpoints.MapPrometheusScrapingEndpoint();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user