Skip to main content
net10.0net8.0net9.0

An Aspire hosting integration to add an OpenTelemetry Collector into the OTLP pipeline.

Published
Sep 28, 2026
21d ago
Total Downloads
71.9K
71,948

Install

dotnet add package CommunityToolkit.Aspire.Hosting.OpenTelemetryCollector --version 13.5.1-beta.779
ProductVersions
.NET
net10.0net8.0net9.0

README

CommunityToolkit.Aspire.Hosting.OpenTelemetryCollector

Overview

This Aspire Integration can be used to include OpenTelemetry Collector in a container.

Usage

Example 1: Add OpenTelemetry Collector without automatic redirection

In this approach, only the projects and resource that you forward the collector to will have their telemetry forwarded to the collector.

var builder = DistributedApplication.CreateBuilder(args);


var collector = builder.AddOpenTelemetryCollector("opentelemetry-collector")
    .WithConfig("./config.yaml");

builder.AddProject<Projects.CommunityToolkit_Aspire_Hosting_OpenTelemetryCollector_Api>("api")
    .WithOpenTelemetryCollectorRouting(collector);

builder.Build().Run();

Example 2: Add OpenTelemetry Collector with automatic redirection

In this approach, all projects and resources that have the OtlpExporterAnnotation will have their telemetry forwarded to the collector.

var builder = DistributedApplication.CreateBuilder(args);


var collector = builder.AddOpenTelemetryCollector("opentelemetry-collector")
    .WithConfig("./config.yaml")
    .WithAppForwarding();

builder.AddProject<Projects.CommunityToolkit_Aspire_Hosting_OpenTelemetryCollector_Api>("api");

builder.Build().Run();

Changes from Previous Version

No structural changes between v13.5.1-beta.777 and v13.5.1-beta.779.

Adoption Assessment

A verified publisher signal is available. Assess fit from the package's supported frameworks, license and dependency graph rather than popularity alone.

This version is marked prerelease. Validate its API and upgrade path before production use.Compatibility metadata lists 3 target frameworks; confirm the exact target used by your application.

Related Guides & Workflows

Learn how to evaluate, integrate, or audit this package in your .NET project.