From c5d11e12fe924c6ea37a32e387f6ce3739c970b0 Mon Sep 17 00:00:00 2001 From: Serge K Date: Tue, 17 Dec 2024 14:30:41 +0700 Subject: [PATCH] update metric pusher --- .../HostedServiceMetricPusher.csproj | 2 +- src/HostedServiceMetricPusher/Program.cs | 3 +-- src/WebMetricPusher/Startup.cs | 7 ------- src/WebMetricPusher/WebMetricPusher.csproj | 1 - 4 files changed, 2 insertions(+), 11 deletions(-) diff --git a/src/HostedServiceMetricPusher/HostedServiceMetricPusher.csproj b/src/HostedServiceMetricPusher/HostedServiceMetricPusher.csproj index 711081e..88a49b3 100644 --- a/src/HostedServiceMetricPusher/HostedServiceMetricPusher.csproj +++ b/src/HostedServiceMetricPusher/HostedServiceMetricPusher.csproj @@ -5,7 +5,7 @@ - + diff --git a/src/HostedServiceMetricPusher/Program.cs b/src/HostedServiceMetricPusher/Program.cs index 7689101..6877afd 100644 --- a/src/HostedServiceMetricPusher/Program.cs +++ b/src/HostedServiceMetricPusher/Program.cs @@ -1,4 +1,3 @@ -using System; using HostedServiceMetricPusher; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; @@ -15,7 +14,7 @@ var host = Host.CreateDefaultBuilder(args) .ConfigureServices(services => { - services.AddMetricPusherService(metricPusher, TimeSpan.FromSeconds(1)); + services.AddMetricPusherHostedService(metricPusher); services.AddHostedService(); }) .Build(); diff --git a/src/WebMetricPusher/Startup.cs b/src/WebMetricPusher/Startup.cs index e004435..26a79d3 100644 --- a/src/WebMetricPusher/Startup.cs +++ b/src/WebMetricPusher/Startup.cs @@ -4,7 +4,6 @@ using Microsoft.Extensions.DependencyInjection; using Prometheus.Client.Collectors; using Prometheus.Client.DependencyInjection; -using Prometheus.Client.HttpRequestDurations; using Prometheus.Client.MetricPusher; namespace WebMetricPusher; @@ -32,12 +31,6 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env) app.UseEndpoints(endpoints => { endpoints.MapControllers(); }); - app.UsePrometheusRequestDurations(q => - { - q.IncludePath = true; - q.IncludeMethod = true; - }); - var registry = app.ApplicationServices.GetService(); var pusher = new MetricPusher(new MetricPusherOptions { diff --git a/src/WebMetricPusher/WebMetricPusher.csproj b/src/WebMetricPusher/WebMetricPusher.csproj index f6f84eb..6055fb1 100644 --- a/src/WebMetricPusher/WebMetricPusher.csproj +++ b/src/WebMetricPusher/WebMetricPusher.csproj @@ -4,7 +4,6 @@ -