save progress
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Routing;
|
||||
using StellaOps.Scanner.WebService.Services;
|
||||
|
||||
namespace StellaOps.Scanner.WebService.Endpoints;
|
||||
|
||||
internal static class ObservabilityEndpoints
|
||||
{
|
||||
public static void MapObservabilityEndpoints(this IEndpointRouteBuilder endpoints)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(endpoints);
|
||||
|
||||
endpoints.MapGet("/metrics", HandleMetricsAsync)
|
||||
.WithName("scanner.metrics")
|
||||
.Produces(StatusCodes.Status200OK);
|
||||
}
|
||||
|
||||
private static IResult HandleMetricsAsync(OfflineKitMetricsStore metricsStore)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(metricsStore);
|
||||
|
||||
var payload = metricsStore.RenderPrometheus();
|
||||
return Results.Text(payload, contentType: "text/plain; version=0.0.4; charset=utf-8");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user