JGUZDV.Extensions.OpenTelemetry 1.1.2

dotnet add package JGUZDV.Extensions.OpenTelemetry --version 1.1.2
                    
NuGet\Install-Package JGUZDV.Extensions.OpenTelemetry -Version 1.1.2
                    
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="JGUZDV.Extensions.OpenTelemetry" Version="1.1.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="JGUZDV.Extensions.OpenTelemetry" Version="1.1.2" />
                    
Directory.Packages.props
<PackageReference Include="JGUZDV.Extensions.OpenTelemetry" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add JGUZDV.Extensions.OpenTelemetry --version 1.1.2
                    
#r "nuget: JGUZDV.Extensions.OpenTelemetry, 1.1.2"
                    
#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.
#:package JGUZDV.Extensions.OpenTelemetry@1.1.2
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=JGUZDV.Extensions.OpenTelemetry&version=1.1.2
                    
Install as a Cake Addin
#tool nuget:?package=JGUZDV.Extensions.OpenTelemetry&version=1.1.2
                    
Install as a Cake Tool

JGUZDV.Extensions.OpenTelemetry

General

Provides a simple preconfigured way for .NET applications to integrate OpenTelemetry transferring data to Azure Monitor resources.

Usage

To add OpenTelemetry support to your .NET application, just add the following line while configuring your HostApplicationBuilder:

builder.AddJGUZDVOpenTelemetry();

or

Host.CreateApplicationBuilder()
    .AddJGUZDVOpenTelemetry();

Configuration

Basic configuration settings to initialize the services should be configured as in the following example in your appsettings (root level):

  ...
  "OpenTelemetry": {
    "AzureMonitor": {
      "ConnectionString": "<AzureMonitorConnectionString>"
    },
    "ServiceNamespace": "<AppNamespace>",
    "ServiceName": "<AppName>",
    "Metrics": {
      "MeterName": "<AppMeterName>",
      "MeterVersion": "<AppMeterVersion>"
    }
  },
  ...

Explanation: If no "OpenTelemetry" section can be found, nothing will happen at all. If such a section is present, the included parameters will be checked. ConnectionString is obviously a mandatory config parameter. WebAppNamespace should describe a summarizing border or boundary, and WebAppName should be the concrete and unique name of the WebApp. The name and namespace parameters should be about 10 to 15 characters, the strings should not include any whitespace or special characters. The section "UseMeter" is optional, but if it is present, the two inner fields are mandatory.

Meter

If you wish to send metrics for your application follow these steps:

  • Configure "OpenTelemetry:UseMetrics" section in appsettings.json
  • Implement a service inheriting from JGUZDVBaseMeter
  • Add the service to the service container as singleton

The service registration should look like this:

builder.AddJGUZDVOpenTelemetry();
builder.Services.AddSingleton<MeterContainer>();

MeterContainer should look something like this:

public class MeterContainer : JGUZDVBaseMeter
{
    private readonly Counter<int> _exampleCounter;

    public MeterContainer(IOptions<JGUZDVOpenTelemetryOptions> options) : base(options)
    {
        _exampleCounter = Meter.CreateCounter<int>(
            name: "webappname.example.count",
            description: "An example counter for your webapp.");
    }

    // Call this to send count metrics.
    public void CountExample()
    {
        _exampleCounter.Add(1);
    }
}

Note:

  • Please find meaningful names for your instruments!
  • The needed options are prepared in the AddJGUZDVOpenTelemetry extension method.
  • The "Meter" instance is created in the base constructor.
Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on JGUZDV.Extensions.OpenTelemetry:

Package Downloads
JGUZDV.JobHost

Host for background jobs using Quartz.net

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.1.2 84 9/29/2026
1.1.1 128 5/22/2026
1.1.0 172 2/2/2026
1.0.3 241 6/24/2025
1.0.2 215 6/24/2025
1.0.1 291 4/9/2025
1.0.0 228 4/9/2025