ic

Icomm.Telemetry.AspNetCore (0.1.8)

Published 2025-05-05 22:28:11 +07:00 by Long Nguyễn Đình - Core

Installation

dotnet nuget add source --name ic --username your_username --password your_token https://git.icomm.vn/api/packages/ic/nuget/index.json
dotnet add package --source ic --version 0.1.8 Icomm.Telemetry.AspNetCore

About this package

OpenTelemetry

Getting started

NuGet package:

dotnet add package Icomm.Telemetry.AspNetCore

Register DI:

using OpenTelemetry.Trace;

services.AddIcOpenTelemetry(
    configuration,
    configure: options =>
    {
        options.TracingSources = options.MetricSources = new[]
        {
            // Tracer.OpenTelemetry.Fody
            Tracer.OpenTelemetry.ActivitySourceConstants.Name
        };
        options.AddAspNetCore();
        // Extra Tracing
        options.Tracing += b =>
        {

        };
    }
);

Extra Tracing

SqlClient

Nuget:

dotnet add package OpenTelemetry.Instrumentation.SqlClient --prerelease

Code:

// https://github.com/open-telemetry/opentelemetry-dotnet/tree/main/src/OpenTelemetry.Instrumentation.SqlClient
configuration.ConfigureIfEnable(
    config => b.AddSqlClientInstrumentation(opt => config.Bind(opt)),
    "OpenTelemetry",
    "Instrumentation",
    "SqlClient"
);

GrpcCore

Nuget:

dotnet add package OpenTelemetry.Instrumentation.GrpcCore --prerelease

Code:

//// https://github.com/open-telemetry/opentelemetry-dotnet-contrib/tree/main/src/OpenTelemetry.Instrumentation.GrpcCore
//configuration.ConfigureIfEnable(config => b.AddGrpcCoreInstrumentation(), "OpenTelemetry", "Instrumentation", "GrpcCore");

GrpcClient

Nuget:

dotnet add package OpenTelemetry.Instrumentation.GrpcNetClient --prerelease

Code:

// https://github.com/open-telemetry/opentelemetry-dotnet/tree/main/src/OpenTelemetry.Instrumentation.GrpcNetClient
configuration.ConfigureIfEnable(
    config =>
        b.AddGrpcClientInstrumentation(opt =>
        {
            config.Bind(opt);
            opt.EnrichWithHttpRequestMessage = options!.Enrich;
            opt.EnrichWithHttpResponseMessage = options!.Enrich;
        }),
    "OpenTelemetry",
    "Instrumentation",
    "GrpcClient"
);

ElasticsearchClient

Nuget:

dotnet add package OpenTelemetry.Instrumentation.ElasticsearchClient --prerelease

Code:

// https://github.com/open-telemetry/opentelemetry-dotnet-contrib/tree/main/src/OpenTelemetry.Instrumentation.ElasticsearchClient
configuration.ConfigureIfEnable(config => b.AddElasticsearchClientInstrumentation(opt => config.Bind(opt)), "OpenTelemetry", "Instrumentation", "ElasticsearchClient");

EntityFrameworkCore

Nuget:

dotnet add package OpenTelemetry.Instrumentation.EntityFrameworkCore --prerelease

Code:

// https://github.com/open-telemetry/opentelemetry-dotnet-contrib/tree/main/src/OpenTelemetry.Instrumentation.EntityFrameworkCore
configuration.ConfigureIfEnable(
    config => b.AddEntityFrameworkCoreInstrumentation(opt => config.Bind(opt)),
    "OpenTelemetry",
    "Instrumentation",
    "EntityFrameworkCore"
);

Hangfire

Nuget:

dotnet add package OpenTelemetry.Instrumentation.Hangfire --prerelease

Code:

// https://github.com/open-telemetry/opentelemetry-dotnet-contrib/tree/main/src/OpenTelemetry.Instrumentation.Hangfire
configuration.ConfigureIfEnable(config => b.AddHangfireInstrumentation(), "OpenTelemetry", "Instrumentation", "Hangfire");

Quartz

Nuget:

dotnet add package OpenTelemetry.Instrumentation.Quartz --prerelease

Code:

// https://github.com/open-telemetry/opentelemetry-dotnet-contrib/tree/main/src/OpenTelemetry.Instrumentation.Quartz
configuration.ConfigureIfEnable(config => b.AddQuartzInstrumentation(opt => config.Bind(opt)), "OpenTelemetry", "Instrumentation", "Quartz");

Redis

Nuget:

dotnet add package OpenTelemetry.Instrumentation.StackExchangeRedis --prerelease

Code:

// https://github.com/open-telemetry/opentelemetry-dotnet-contrib/tree/main/src/OpenTelemetry.Instrumentation.StackExchangeRedis
configuration.ConfigureIfEnable(config => b.AddRedisInstrumentation(configure: opt => config.Bind(opt)), "OpenTelemetry", "Instrumentation", "Redis");    

Dependencies

ID Version Target Framework
Icomm.Telemetry 0.1.8 net6.0
OpenTelemetry.Exporter.Prometheus 1.3.0-rc.2 net6.0
OpenTelemetry.Instrumentation.AspNetCore 1.6.0-rc.1 net6.0
Details
NuGet
2025-05-05 22:28:11 +07:00
23
long.nguyen
12 KiB
Assets (2)
Versions (14) View all
0.2.8 2025-10-10
0.2.4 2025-10-10
0.2.1 2025-05-06
0.2.3 2025-05-05
0.2.2 2025-05-05