Skip to content

Commit

Permalink
update metric pusher
Browse files Browse the repository at this point in the history
  • Loading branch information
phnx47 committed Dec 17, 2024
1 parent b30989d commit c5d11e1
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<ItemGroup>
<PackageReference Include="Prometheus.Client" Version="5.2.0" />
<PackageReference Include="Prometheus.Client.DependencyInjection" Version="1.4.0" />
<PackageReference Include="Prometheus.Client.MetricPusher.HostedService" Version="0.3.0" />
<PackageReference Include="Prometheus.Client.MetricPusher.HostedService" Version="0.4.0" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="7.0.1" />
</ItemGroup>
</Project>
3 changes: 1 addition & 2 deletions src/HostedServiceMetricPusher/Program.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
using System;
using HostedServiceMetricPusher;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
Expand All @@ -15,7 +14,7 @@
var host = Host.CreateDefaultBuilder(args)
.ConfigureServices(services =>
{
services.AddMetricPusherService(metricPusher, TimeSpan.FromSeconds(1));
services.AddMetricPusherHostedService(metricPusher);
services.AddHostedService<Worker>();
})
.Build();
Expand Down
7 changes: 0 additions & 7 deletions src/WebMetricPusher/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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<ICollectorRegistry>();
var pusher = new MetricPusher(new MetricPusherOptions
{
Expand Down
1 change: 0 additions & 1 deletion src/WebMetricPusher/WebMetricPusher.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Prometheus.Client" Version="5.2.0" />
<PackageReference Include="Prometheus.Client.HttpRequestDurations" Version="4.0.0" />
<PackageReference Include="Prometheus.Client.MetricPusher" Version="3.2.0" />
<PackageReference Include="Prometheus.Client.DependencyInjection" Version="1.4.0" />
</ItemGroup>
Expand Down

0 comments on commit c5d11e1

Please sign in to comment.