Intropy.Telemetry.ConsoleApp 0.1.0

dotnet add package Intropy.Telemetry.ConsoleApp --version 0.1.0
                    
NuGet\Install-Package Intropy.Telemetry.ConsoleApp -Version 0.1.0
                    
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="Intropy.Telemetry.ConsoleApp" Version="0.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Intropy.Telemetry.ConsoleApp" Version="0.1.0" />
                    
Directory.Packages.props
<PackageReference Include="Intropy.Telemetry.ConsoleApp" />
                    
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 Intropy.Telemetry.ConsoleApp --version 0.1.0
                    
#r "nuget: Intropy.Telemetry.ConsoleApp, 0.1.0"
                    
#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 Intropy.Telemetry.ConsoleApp@0.1.0
                    
#: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=Intropy.Telemetry.ConsoleApp&version=0.1.0
                    
Install as a Cake Addin
#tool nuget:?package=Intropy.Telemetry.ConsoleApp&version=0.1.0
                    
Install as a Cake Tool

Intropy.Telemetry

Simple OpenTelemetry configuration for .NET applications. Hook up tracing, metrics and logging with a single method call.

Why?

Setting up OpenTelemetry in .NET involves a fair amount of boilerplate: configuring resource attributes, wiring up instrumentations, adding OTLP exporters, enriching exceptions, filtering health checks, etc. This library packages all of that into a simple AddOpenTelemetry extension method so you don't have to repeat it across every project.

Packages

Package Description
Intropy.Telemetry.AspNetCore For ASP.NET Core web applications
Intropy.Telemetry.ConsoleApp For console applications and background workers

Getting Started

ASP.NET Core

dotnet add package Intropy.Telemetry.AspNetCore
using Intropy.Telemetry.AspNetCore;

var builder = WebApplication.CreateBuilder(args);

builder.Services.AddOpenTelemetry(config =>
{
    config.ServiceName = "MyService";
    config.Environment = builder.Environment.EnvironmentName;
});

var app = builder.Build();
app.Run();

Console Application

dotnet add package Intropy.Telemetry.ConsoleApp
using Intropy.Telemetry.ConsoleApp;
using Microsoft.Extensions.DependencyInjection;

var services = new ServiceCollection();

services.AddOpenTelemetry(config =>
{
    config.ServiceName = "MyWorker";
    config.Environment = "Production";
});

var serviceProvider = services.BuildServiceProvider();
using var telemetryScope = new OpenTelemetryScope(serviceProvider);

// Your application code here

What You Get Out of the Box

Tracing

  • ASP.NET Core requests (ASP.NET Core package only)
  • Outbound HTTP calls
  • SQL Client database operations
  • gRPC client calls
  • Automatic exception enrichment with type, message, and stack trace

Metrics

  • ASP.NET Core HTTP request metrics (ASP.NET Core package only)
  • HTTP client metrics

Logging

  • OTLP export of structured logs

All telemetry is exported via OTLP, configured through standard OpenTelemetry environment variables:

OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4317

Configuration

Both packages expose the same configuration pattern via OpenTelemetryConfiguration:

Property Type Required Description
ServiceName string Yes Name of the service, e.g. "Orders.API"
Environment string Yes Environment name, e.g. "Production"
ServiceNamespace string No Namespace/organization
ServiceVersion string No Defaults to the entry assembly version
ConfigureTracing Action<TracerProviderBuilder>? No Add custom trace sources or instrumentations
ConfigureMetrics Action<MeterProviderBuilder>? No Add custom meters
ConfigureLogging Action<LoggerProviderBuilder>? No Additional logging configuration
ConfigureResource Action<ResourceBuilder>? No Add custom resource attributes

The ASP.NET Core package also exposes:

Property Type Required Description
FilterHttpRequest Func<HttpContext, bool> No Filter which requests are traced. Defaults to excluding /healthz

Full Example

builder.Services.AddOpenTelemetry(config =>
{
    config.ServiceName = "Orders.API";
    config.ServiceNamespace = "mycompany";
    config.Environment = "Production";
    config.ServiceVersion = "2.1.0";

    config.ConfigureTracing = tracing =>
    {
        tracing.AddSource("MyCustomActivitySource");
    };

    config.ConfigureMetrics = metrics =>
    {
        metrics.AddMeter("MyCustomMeter");
    };

    config.ConfigureResource = resource =>
    {
        resource.AddAttributes([
            new KeyValuePair<string, object>("team", "backend")
        ]);
    };
});

Requirements

  • .NET 10.0+

Contributing

To build and test locally:

dotnet build
dotnet test

License

This project is licensed under the MIT License.

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

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.1.0 57 4/23/2026