OpenTelemetry.Instrumentation.EventCounters
1.13.0-alpha.1
Prefix Reserved
dotnet add package OpenTelemetry.Instrumentation.EventCounters --version 1.13.0-alpha.1
NuGet\Install-Package OpenTelemetry.Instrumentation.EventCounters -Version 1.13.0-alpha.1
<PackageReference Include="OpenTelemetry.Instrumentation.EventCounters" Version="1.13.0-alpha.1" />
<PackageVersion Include="OpenTelemetry.Instrumentation.EventCounters" Version="1.13.0-alpha.1" />
<PackageReference Include="OpenTelemetry.Instrumentation.EventCounters" />
paket add OpenTelemetry.Instrumentation.EventCounters --version 1.13.0-alpha.1
#r "nuget: OpenTelemetry.Instrumentation.EventCounters, 1.13.0-alpha.1"
#:package OpenTelemetry.Instrumentation.EventCounters@1.13.0-alpha.1
#addin nuget:?package=OpenTelemetry.Instrumentation.EventCounters&version=1.13.0-alpha.1&prerelease
#tool nuget:?package=OpenTelemetry.Instrumentation.EventCounters&version=1.13.0-alpha.1&prerelease
EventCounters Instrumentation for OpenTelemetry .NET
| Status | |
|---|---|
| Stability | Alpha |
| Code Owners | @hananiel, @mic-max |
This is an Instrumentation Library , which republishes EventCounters using OpenTelemetry Metrics API.
Steps to enable OpenTelemetry.Instrumentation.EventCounters
You can view an example project using EventCounters at
/examples/event-counters/Examples.EventCounters.
Step 1: Install Package
Add a reference to the
OpenTelemetry.Instrumentation.EventCounters
package.
dotnet add package OpenTelemetry.Instrumentation.EventCounters --prerelease
Step 2: Enable EventCounters Instrumentation
EventCounters instrumentation should be enabled at application startup using the
AddEventCountersInstrumentation extension on the MeterProviderBuilder:
using var meterProvider = Sdk.CreateMeterProviderBuilder()
.AddEventCountersInstrumentation(options => {
options.RefreshIntervalSecs = 1;
options.AddEventSources("MyEventSource");
})
.AddPrometheusHttpListener()
.Build();
Additionally, the above snippet sets up the OpenTelemetry Prometheus exporter, which
requires adding the package
OpenTelemetry.Exporter.Prometheus
to the application.
Step 3: Create EventCounters
Learn about EventCounters in .NET .
EventSource eventSource = new("MyEventSource");
EventCounter eventCounter = new("MyEventCounterName", eventSource);
eventCounter.WriteMetric(0);
eventCounter.WriteMetric(1000);
PollingCounter pollingCounter = new("MyPollingCounterName", eventSource, () => new Random().NextDouble());
Notes
The metrics will only be available after EventCounterIntervalSec seconds.
Before that nothing will be exported, if anything is present at the Prometheus
metrics endpoint it is from a prior execution. This is more evident when using
longer polling intervals.
References
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. 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. net9.0 was computed. 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. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- OpenTelemetry.Api (>= 1.13.1 && < 2.0.0)
NuGet packages (10)
Showing the top 5 NuGet packages that depend on OpenTelemetry.Instrumentation.EventCounters:
| Package | Downloads |
|---|---|
|
ShtrihM.Wattle3.OpenTelemetry
Framework for creating high-performance servers with domain object models. |
|
|
Acme.Wattle.OpenTelemetry
Framework for creating high-performance servers with domain object models. |
|
|
Indiko.Blocks.Tracing.OpenTelemetry
Building Blocks Tracing OpenTelemetry |
|
|
BytLabs.Observability
Package Description |
|
|
BusAppCore.CommandQuery
BusAppCore CQRS support library |
GitHub repositories (2)
Showing the top 2 popular GitHub repositories that depend on OpenTelemetry.Instrumentation.EventCounters:
| Repository | Stars |
|---|---|
|
microsoft/dotnet-podcasts
.NET reference application shown at .NET Conf featuring ASP.NET Core, Blazor, .NET MAUI, Microservices, Orleans, Playwright, and more!
|
|
|
marinasundstrom/YourBrand
Prototype enterprise system for e-commerce and consulting services
|
| Version | Downloads | Last Updated |
|---|---|---|
| 1.13.0-alpha.1 | 458 | 10/23/2025 |
| 1.5.1-alpha.1 | 4,729,325 | 7/11/2023 |
| 1.0.0-alpha.2 | 1,026,613 | 11/11/2022 |
| 1.0.0-alpha.1 | 36,995 | 10/17/2022 |
| 0.1.0-alpha.1 | 45,177 | 7/12/2022 |