Prometheus.Client.MetricServer 6.0.0

The ID prefix of this package has been reserved for one of the owners of this package by NuGet.org. Prefix Reserved
dotnet add package Prometheus.Client.MetricServer --version 6.0.0
NuGet\Install-Package Prometheus.Client.MetricServer -Version 6.0.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Prometheus.Client.MetricServer" Version="6.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Prometheus.Client.MetricServer --version 6.0.0
#r "nuget: Prometheus.Client.MetricServer, 6.0.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Prometheus.Client.MetricServer as a Cake Addin
#addin nuget:?package=Prometheus.Client.MetricServer&version=6.0.0

// Install Prometheus.Client.MetricServer as a Cake Tool
#tool nuget:?package=Prometheus.Client.MetricServer&version=6.0.0

Prometheus.Client.MetricServer

ci nuget nuget codecov codefactor license

Extension for Prometheus.Client

Install

dotnet add package Prometheus.Client.MetricServer

Use

There are Examples

Simple Console App with static MetricFactory:

public static void Main(string[] args)
{

    var options = new MetricServerOptions
    {
        Port = 9091
    };

    IMetricServer metricServer = new MetricServer(options);
    metricServer.Start();
    ...

    var counter =  Metrics.DefaultFactory.CreateCounter("test_count", "helptext");
    counter.Inc();
    ...

    metricServer.Stop();
}

Worker with DI extension:

public static async Task Main(string[] args)
{
    var host = Host.CreateDefaultBuilder(args)
        .ConfigureServices((_, services) =>
        {
            services.AddMetricFactory();
            services.AddSingleton<IMetricServer>(sp => new MetricServer(
                new MetricServerOptions
                {
                    CollectorRegistryInstance = sp.GetRequiredService<ICollectorRegistry>(),
                    UseDefaultCollectors = true
                }));
            services.AddHostedService<Worker>();
        }).Build();

    var metricServer = host.Services.GetRequiredService<IMetricServer>();

    try
    {
        metricServer.Start();
        await host.RunAsync();
    }
    catch (Exception ex)
    {
        Console.WriteLine("Host Terminated Unexpectedly");
    }
    finally
    {
        metricServer.Stop();
    }
}

License

All contents of this package are licensed under the MIT license.

Product Compatible and additional computed target framework versions.
.NET net5.0 is compatible.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp3.1 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on Prometheus.Client.MetricServer:

Package Downloads
ShayganTadbir.Framework.Core

Package description

sampleseqproject

Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
6.0.0 3,907 9/23/2023
5.0.0 27,803 9/3/2022
4.4.0 29,542 4/6/2022
4.3.1 20,849 6/9/2021
4.3.0 939 6/3/2021
4.2.0 1,148 5/23/2021
4.1.0 5,972 1/29/2021
4.0.0 12,155 8/22/2020
3.1.0 13,956 1/21/2020
3.0.1 10,535 6/4/2019
3.0.0 1,489 5/14/2019
3.0.0-rc1 944 4/9/2019
2.1.1 78,421 3/24/2019
2.1.0 9,077 1/16/2019
2.0.2 27,255 10/30/2018
2.0.1 1,331 10/19/2018
1.3.2 4,450 8/25/2018
1.3.1 2,392 4/23/2018
1.2.2 34,667 2/23/2018
1.1.3 1,674 12/6/2017
1.1.2 2,426 5/10/2017