Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork10
prom-client-net/prom-client-metricserver
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Extension forPrometheus.Client
dotnet add package Prometheus.Client.MetricServer
Simple Console App with static MetricFactory:
publicstaticvoidMain(string[]args){varoptions=newMetricServerOptions{Port=9091};varmetricServer=newMetricServer(options);metricServer.Start();varcounter=Metrics.DefaultFactory.CreateCounter("test_count","helptext");counter.Inc();metricServer.Stop();}
Worker with DIPrometheus.Client.DependencyInjection:
publicstaticasyncTaskMain(string[]args){varhost=Host.CreateDefaultBuilder(args).ConfigureServices((_,services)=>{services.AddMetricFactory();services.AddSingleton<IMetricServer>(sp=>newMetricServer(newMetricServerOptions{CollectorRegistry=sp.GetRequiredService<ICollectorRegistry>(),UseDefaultCollectors=true}));services.AddHostedService<Worker>();}).Build();varmetricServer=host.Services.GetRequiredService<IMetricServer>();try{metricServer.Start();awaithost.RunAsync();}catch(Exceptionex){Console.WriteLine("Host Terminated Unexpectedly");}finally{metricServer.Stop();}}
All contents of this package are licensed under theMIT license.
About
Standalone Kestrel server
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Sponsor this project
Uh oh!
There was an error while loading.Please reload this page.
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Contributors10
Uh oh!
There was an error while loading.Please reload this page.