{"id":13430194,"url":"https://github.com/prom-client-net/prom-client","last_synced_at":"2026-02-15T12:03:30.162Z","repository":{"id":39668360,"uuid":"83782930","full_name":"prom-client-net/prom-client","owner":"prom-client-net","description":".NET client for Prometheus","archived":false,"fork":false,"pushed_at":"2026-02-11T00:47:58.000Z","size":1317,"stargazers_count":137,"open_issues_count":2,"forks_count":22,"subscribers_count":3,"default_branch":"main","last_synced_at":"2026-02-11T04:04:34.513Z","etag":null,"topics":["metrics","prometheus","prometheus-client"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/prom-client-net.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":"phnx47","ko_fi":"phnx47","buy_me_a_coffee":"phnx47"}},"created_at":"2017-03-03T09:44:01.000Z","updated_at":"2026-02-11T00:47:35.000Z","dependencies_parsed_at":"2023-02-09T19:45:33.074Z","dependency_job_id":"f65e4549-fa93-41b7-972d-279ec6a53432","html_url":"https://github.com/prom-client-net/prom-client","commit_stats":null,"previous_names":["prometheusclientnet/prometheus.client"],"tags_count":38,"template":false,"template_full_name":null,"purl":"pkg:github/prom-client-net/prom-client","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prom-client-net%2Fprom-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prom-client-net%2Fprom-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prom-client-net%2Fprom-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prom-client-net%2Fprom-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/prom-client-net","download_url":"https://codeload.github.com/prom-client-net/prom-client/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prom-client-net%2Fprom-client/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29477307,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-15T11:35:25.641Z","status":"ssl_error","status_checked_at":"2026-02-15T11:34:57.128Z","response_time":118,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["metrics","prometheus","prometheus-client"],"created_at":"2024-07-31T02:00:50.945Z","updated_at":"2026-02-15T12:03:30.131Z","avatar_url":"https://github.com/prom-client-net.png","language":"C#","funding_links":["https://github.com/sponsors/phnx47","https://ko-fi.com/phnx47","https://buymeacoffee.com/phnx47"],"categories":["Frameworks, Libraries and Tools"],"sub_categories":["Code Analysis and Metrics"],"readme":"# Prometheus.Client\n\n[asp-net-core]: https://github.com/prom-client-net/prom-client-aspnetcore\n[dependency-injection]: https://github.com/prom-client-net/prom-client-dependencyinjection\n[http-request-durations]: https://github.com/prom-client-net/prom-client-httprequestdurations\n[metric-pusher]: https://github.com/prom-client-net/prom-client-metricpusher\n[metric-pusher-hosted-service]: https://github.com/prom-client-net/prom-client-metricpusher-hostedservice\n[health-checks]: https://github.com/prom-client-net/prom-client-healthchecks\n[metric-server]: https://github.com/prom-client-net/prom-client-metricserver\n[owin]: https://github.com/prom-client-net/prom-client-owin\n\n[![ci](https://img.shields.io/github/actions/workflow/status/prom-client-net/prom-client/ci.yml?branch=main\u0026label=ci\u0026logo=github\u0026style=flat-square)](https://github.com/prom-client-net/prom-client/actions/workflows/ci.yml)\n[![nuget](https://img.shields.io/nuget/v/Prometheus.Client?logo=nuget\u0026style=flat-square)](https://www.nuget.org/packages/Prometheus.Client)\n[![nuget](https://img.shields.io/nuget/dt/Prometheus.Client?logo=nuget\u0026style=flat-square)](https://www.nuget.org/packages/Prometheus.Client)\n[![codecov](https://img.shields.io/codecov/c/github/prom-client-net/prom-client?logo=codecov\u0026style=flat-square)](https://app.codecov.io/gh/prom-client-net/prom-client)\n[![license](https://img.shields.io/github/license/prom-client-net/prom-client?style=flat-square)](https://github.com/prom-client-net/prom-client/blob/main/LICENSE)\n\n.NET Client library for [prometheus.io](https://prometheus.io/)\n\nIt is hard fork of [prometheus-net](https://github.com/prometheus-net/prometheus-net) from early 2017 that has since evolved into a different library.\n\nOur main goals:\n\n- Keep possibility of rapid development.\n- Extensibility is one of the core values, together with performance and minimal allocation.\n- We are open for suggestions and new ideas, contribution is always welcomed.\n\nYou can find the [benchmark descriptions](https://github.com/prom-client-net/prom-client/blob/main/docs/benchmarks).\n\n## Install\n\n```sh\ndotnet add package Prometheus.Client\n```\n\n### Extensions\n\n| Name                                                                         | Description                            |\n| ---------------------------------------------------------------------------- | -------------------------------------- |\n| [Prometheus.Client.AspNetCore][asp-net-core]                                 | ASP.NET Core middleware                |\n| [Prometheus.Client.DependencyInjection][dependency-injection]                | Dependency Injection extensions        |\n| [Prometheus.Client.HttpRequestDurations][http-request-durations]             | Metrics logging of request durations   |\n| [Prometheus.Client.MetricPusher][metric-pusher]                              | Push metrics to Prometheus PushGateway |\n| [Prometheus.Client.MetricPusher.HostedService][metric-pusher-hosted-service] | MetricPusher as HostedService          |\n| [Prometheus.Client.HealthChecks][health-checks]                              | HealthChecks Publisher                 |\n| [Prometheus.Client.MetricServer][metric-server]                              | Standalone Kestrel server              |\n| [Prometheus.Client.Owin][owin]                                               | Owin middleware                        |\n\n## Use\n\n[Examples](https://github.com/prom-client-net/prom-examples)\n\n[Prometheus Docs](https://prometheus.io/docs/introduction/overview/)\n\nAdd metrics endpoint without extension:\n\n```c#\n[Route(\"[controller]\")]\npublic class MetricsController : Controller\n{\n    private readonly ICollectorRegistry _registry;\n\n    public MetricsController(ICollectorRegistry registry)\n    {\n        _registry = registry;\n    }\n\n    [HttpGet]\n    public async Task Get()\n    {\n        Response.StatusCode = 200;\n        await using var outputStream = Response.Body;\n        await ScrapeHandler.ProcessAsync(_registry, outputStream);\n    }\n}\n```\n\nAdd metrics endpoint with [Prometheus.Client.AspNetCore][asp-net-core]:\n\n```c#\npublic void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory, IApplicationLifetime appLifetime)\n{\n    app.UsePrometheusServer();\n}\n```\n\n`IMetricFactory` and `ICollectorRegistry` can be added to DI container with [Prometheus.Client.DependencyInjection][dependency-injection]:\n\n```c#\npublic void ConfigureServices(IServiceCollection services)\n{\n    services.AddMetricFactory();\n}\n```\n\nFor collect http requests, use [Prometheus.Client.HttpRequestDurations][http-request-durations].\nIt does not depend on [Prometheus.Client.AspNetCore][asp-net-core], however together it's very convenient to use:\n\n```c#\npublic void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory, IApplicationLifetime appLifetime)\n{\n    app.UsePrometheusServer();\n    app.UsePrometheusRequestDurations();\n}\n```\n\n### Instrumenting\n\nFour types of metric are offered: `Counter`, `Gauge`, `Summary` and `Histogram`.\nSee the documentation on [metric types](http://prometheus.io/docs/concepts/metric_types/)\nand [instrumentation best practices](http://prometheus.io/docs/practices/instrumentation/#counter-vs.-gauge-vs.-summary)\non how to use them.\n\n### Counter\n\nCounters go up, and reset when the process restarts.\n\n```c#\nvar counter = metricFactory.CreateCounter(\"myCounter\", \"some help about this\");\ncounter.Inc(5.5);\n```\n\n### Gauge\n\nGauges can go up and down.\n\n```c#\nvar gauge = metricFactory.CreateGauge(\"gauge\", \"help text\");\ngauge.Inc(3.4);\ngauge.Dec(2.1);\ngauge.Set(5.3);\n```\n\n### Summary\n\nSummaries track the size and number of events.\n\n```c#\nvar summary = metricFactory.CreateSummary(\"mySummary\", \"help text\");\nsummary.Observe(5.3);\n```\n\n### Histogram\n\nHistograms track the size and number of events in buckets.\nThis allows for aggregate calculation of quantiles.\n\n```c#\nvar hist = metricFactory.CreateHistogram(\"my_histogram\", \"help text\", buckets: new[] { 0, 0.2, 0.4, 0.6, 0.8, 0.9 });\nhist.Observe(0.4);\n```\n\nThe default buckets are intended to cover a typical web/rpc request from milliseconds to seconds.\nThey can be overridden passing in the `buckets` argument.\n\n### Labels\n\nAll metrics can have labels, allowing grouping of related time series.\n\nSee the best practices on [naming](http://prometheus.io/docs/practices/naming/)\nand [labels](http://prometheus.io/docs/practices/instrumentation/#use-labels).\n\nTaking a counter as an example:\n\n```c#\nvar counter = metricFactory.CreateCounter(\"myCounter\", \"help text\", labelNames: new []{ \"method\", \"endpoint\"});\ncounter.WithLabels(\"GET\", \"/\").Inc();\ncounter.WithLabels(\"POST\", \"/cancel\").Inc();\n```\n\nSince v4 there is alternative new way to provide a labels via ValueTuple that allow to reduce memory allocation:\n\n```c#\nvar counter = metricFactory.CreateCounter(\"myCounter\", \"help text\", labelNames: (\"method\", \"endpoint\"));\ncounter.WithLabels((\"GET\", \"/\")).Inc();\ncounter.WithLabels((\"POST\", \"/cancel\")).Inc();\n```\n\n## Contribute\n\nContributions to the package are always welcome!\n\n- Report any bugs or issues you find on the [issue tracker](https://github.com/prom-client-net/prom-client/issues).\n- You can grab the source code at the package's [git repository](https://github.com/prom-client-net/prom-client).\n\n## Supporters\n\n[Entity Framework Extensions](https://entityframework-extensions.net) is a major sponsor and is proud to contribute to this project.\n\n[![Entity Framework Extensions](https://raw.githubusercontent.com/prom-client-net/prom-client/main/entity-framework-extensions-sponsor.png)](https://entityframework-extensions.net/bulk-insert)\n\n## License\n\nAll contents of this package are licensed under the [MIT license](https://opensource.org/licenses/MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprom-client-net%2Fprom-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fprom-client-net%2Fprom-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprom-client-net%2Fprom-client/lists"}