OpenTelemetry.Exporter.Prometheus.AspNetCore
1.11.2-beta.1
Prefix Reserved
dotnet add package OpenTelemetry.Exporter.Prometheus.AspNetCore --version 1.11.2-beta.1
NuGet\Install-Package OpenTelemetry.Exporter.Prometheus.AspNetCore -Version 1.11.2-beta.1
<PackageReference Include="OpenTelemetry.Exporter.Prometheus.AspNetCore" Version="1.11.2-beta.1" />
<PackageVersion Include="OpenTelemetry.Exporter.Prometheus.AspNetCore" Version="1.11.2-beta.1" />
<PackageReference Include="OpenTelemetry.Exporter.Prometheus.AspNetCore" />
paket add OpenTelemetry.Exporter.Prometheus.AspNetCore --version 1.11.2-beta.1
#r "nuget: OpenTelemetry.Exporter.Prometheus.AspNetCore, 1.11.2-beta.1"
#addin nuget:?package=OpenTelemetry.Exporter.Prometheus.AspNetCore&version=1.11.2-beta.1&prerelease
#tool nuget:?package=OpenTelemetry.Exporter.Prometheus.AspNetCore&version=1.11.2-beta.1&prerelease
Prometheus Exporter AspNetCore for OpenTelemetry .NET
An OpenTelemetry Prometheus exporter for configuring an ASP.NET Core application with an endpoint for Prometheus to scrape.
[!WARNING] This component is still under development due to a dependency on the experimental Prometheus and OpenMetrics Compatibility specification and can undergo breaking changes before stable release. Production environments should consider using OpenTelemetry.Exporter.OpenTelemetryProtocol. Refer to the Getting Started with Prometheus and Grafana tutorial for more information.
[!NOTE] This exporter does not support Exemplars. For using Exemplars, use the OTLP Exporter and use a component like OTel Collector to expose metrics (with exemplars) to Prometheus. This tutorial shows one way how to do that.
Prerequisite
Steps to enable OpenTelemetry.Exporter.Prometheus.AspNetCore
Step 1: Install Package
dotnet add package --prerelease OpenTelemetry.Exporter.Prometheus.AspNetCore
Step 2: Configure OpenTelemetry MeterProvider
When using OpenTelemetry.Extensions.Hosting package on .NET 6.0+:
services.AddOpenTelemetry() .WithMetrics(builder => builder .AddPrometheusExporter());
Or configure directly:
Call the
MeterProviderBuilder.AddPrometheusExporter
extension to register the Prometheus exporter.var meterProvider = Sdk.CreateMeterProviderBuilder() .AddPrometheusExporter() .Build(); builder.Services.AddSingleton(meterProvider);
Step 3: Configure Prometheus Scraping Endpoint
Register Prometheus scraping middleware using the
UseOpenTelemetryPrometheusScrapingEndpoint
extension method onIApplicationBuilder
:var builder = WebApplication.CreateBuilder(args); var app = builder.Build(); app.UseOpenTelemetryPrometheusScrapingEndpoint();
Overloads of the
UseOpenTelemetryPrometheusScrapingEndpoint
extension are provided to change the path or for more advanced configuration a predicate function can be used:app.UseOpenTelemetryPrometheusScrapingEndpoint( context => context.Request.Path == "/internal/metrics" && context.Connection.LocalPort == 5067);
This can be used in combination with configuring multiple ports on the ASP.NET application to expose the scraping endpoint on a different port.
Configuration
The PrometheusExporter
can be configured using the PrometheusAspNetCoreOptions
properties.
ScrapeEndpointPath
Defines the path for the Prometheus scrape endpoint for the middleware
registered by
UseOpenTelemetryPrometheusScrapingEndpoint
. Default value: "/metrics"
.
ScrapeResponseCacheDurationMilliseconds
Configures scrape endpoint response caching. Multiple scrape requests within the
cache duration time period will receive the same previously generated response.
The default value is 300
. Set to 0
to disable response caching.
Troubleshooting
This component uses an EventSource with the name "OpenTelemetry-Exporter-Prometheus" for its internal logging. Please refer to SDK troubleshooting for instructions on seeing these internal logs.
References
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. 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. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. |
-
net8.0
- OpenTelemetry (>= 1.11.2 && < 2.0.0)
-
net9.0
- OpenTelemetry (>= 1.11.2 && < 2.0.0)
NuGet packages (62)
Showing the top 5 NuGet packages that depend on OpenTelemetry.Exporter.Prometheus.AspNetCore:
Package | Downloads |
---|---|
SharpAbp.Abp.OpenTelemetry.Exporter.Prometheus.AspNetCore
SharpAbp OpenTelemetry Module |
|
ShtrihM.Wattle3.OpenTelemetry
Framework for creating high-performance servers with domain object models. |
|
Packs.Template.BaseApi
Basis for any Packs API |
|
sql-d
Package Description |
|
Jakar.Database
Package Description |
GitHub repositories (34)
Showing the top 20 popular GitHub repositories that depend on OpenTelemetry.Exporter.Prometheus.AspNetCore:
Repository | Stars |
---|---|
dotnet/AspNetCore.Docs
Documentation for ASP.NET Core
|
|
JustArchiNET/ArchiSteamFarm
C# application with primary purpose of farming Steam cards from multiple accounts simultaneously.
|
|
fullstackhero/dotnet-starter-kit
Production Grade Cloud-Ready .NET 9 Starter Kit (Web API + Blazor Client) with Multitenancy Support, and Clean/Modular Architecture that saves roughly 200+ Development Hours! All Batteries Included.
|
|
kurrent-io/EventStore
EventStoreDB, the event-native database. Designed for Event Sourcing, Event-Driven, and Microservices architectures
|
|
dotnet/samples
Sample code referenced by the .NET documentation
|
|
JasperFx/marten
.NET Transactional Document DB and Event Store on PostgreSQL
|
|
microsoft/dotnet-podcasts
.NET reference application shown at .NET Conf featuring ASP.NET Core, Blazor, .NET MAUI, Microservices, Orleans, Playwright, and more!
|
|
exceptionless/Exceptionless
Exceptionless application
|
|
BrighterCommand/Brighter
A framework for building messaging apps with .NET and C#.
|
|
DuendeSoftware/products
The most flexible and standards-compliant OpenID Connect and OAuth 2.x framework for ASP.NET Core
|
|
GZTimeWalker/GZCTF
The GZ::CTF project, an open source CTF platform.
|
|
meysamhadeli/monolith-to-cloud-architecture
A practical architecture styles for migrating from monolith to modern cloud native application with the latest technologies and architectures like Vertical Slice Architecture, Event Sourcing, CQRS, DDD, gRpc, MongoDB, RabbitMq, and Masstransit in .Net 9.
|
|
SteeltoeOSS/Steeltoe
.NET Components for Externalized Configuration, Database Connectors, Service Discovery, Logging and Distributed Tracing, Application Management, Security, and more.
|
|
CodeMazeBlog/CodeMazeGuides
The main repository for all the Code Maze guides
|
|
mehdihadeli/food-delivery-microservices
🍔 A practical and imaginary food delivery microservices, built with .Net 9, MassTransit, Domain-Driven Design, CQRS, Vertical Slice Architecture, Event-Driven Architecture, and the latest technologies.
|
|
Aguafrommars/TheIdServer
OpenID/Connect, OAuth2, WS-Federation and SAML 2.0 server based on Duende IdentityServer and ITFoxtec Identity SAML 2.0 with its admin UI
|
|
streetwriters/notesnook-sync-server
Sync server for Notesnook (self-hosting in alpha)
|
|
Azure/Industrial-IoT
Azure Industrial IoT Platform
|
|
Eventuous/eventuous
Event Sourcing library for .NET
|
|
VocaDB/vocadb
VocaDB is a Vocaloid Database with translated artists, albums, music videos and more.
|
Version | Downloads | Last updated |
---|---|---|
1.11.2-beta.1 | 139,630 | a month ago |
1.11.0-beta.1 | 426,345 | 3 months ago |
1.10.0-beta.1 | 383,305 | 5 months ago |
1.9.0-beta.2 | 3,303,385 | 10 months ago |
1.9.0-beta.1 | 281,029 | 10 months ago |
1.9.0-alpha.2 | 215,203 | 5/29/2024 |
1.9.0-alpha.1 | 47,998 | 5/20/2024 |
1.8.0-rc.1 | 2,470,210 | 3/27/2024 |
1.8.0-beta.1 | 171,040 | 3/14/2024 |
1.7.0-rc.1 | 2,945,181 | 11/30/2023 |
1.7.0-alpha.1 | 190,124 | 10/17/2023 |
1.6.0-rc.1 | 2,823,090 | 8/21/2023 |
1.6.0-alpha.1 | 250,282 | 7/12/2023 |
1.5.0-rc.1 | 1,425,472 | 5/26/2023 |
1.5.0-alpha.1 | 849,908 | 3/8/2023 |
1.4.0-rc.4 | 2,248,864 | 2/11/2023 |
1.4.0-rc.3 | 117,650 | 2/2/2023 |
1.4.0-rc.2 | 125,486 | 1/9/2023 |
1.4.0-rc.1 | 210,971 | 12/12/2022 |
1.4.0-beta.3 | 333,102 | 11/7/2022 |
1.4.0-beta.2 | 277,203 | 10/17/2022 |
1.4.0-beta.1 | 71,688 | 9/30/2022 |
1.4.0-alpha.2 | 114,065 | 8/18/2022 |
For highlights and announcements see: https://github.com/open-telemetry/opentelemetry-dotnet/blob/coreunstable-1.11.2-beta.1/RELEASENOTES.md.
For detailed changes see: https://github.com/open-telemetry/opentelemetry-dotnet/blob/coreunstable-1.11.2-beta.1/src/OpenTelemetry.Exporter.Prometheus.AspNetCore/CHANGELOG.md.