When a request takes too long, the useful clue might be in a log, a metric, or a trace that crosses several services. The Aspire Dashboard can put those signals in one place, even when the app is not running inside an Aspire AppHost.
Your app can send telemetry to the dashboard using OpenTelemetry Protocol, or OTLP.
Add the Packages
In your ASP.NET Core project, add the OpenTelemetry packages:
dotnet add package OpenTelemetry.Extensions.Hostingdotnet add package OpenTelemetry.Exporter.OpenTelemetryProtocoldotnet add package OpenTelemetry.Instrumentation.AspNetCoredotnet add package OpenTelemetry.Instrumentation.HttpConfigure the App
Add this to Program.cs:
using OpenTelemetry.Logs;using OpenTelemetry.Metrics;using OpenTelemetry.Resources;using OpenTelemetry.Trace;
var builder = WebApplication.CreateBuilder(args);
var endpoint = new Uri( builder.Configuration["OTEL_EXPORTER_OTLP_ENDPOINT"] ?? "http://localhost:4317");
builder.Logging.AddOpenTelemetry(logging =>{ logging.AddOtlpExporter(options => options.Endpoint = endpoint);});
builder.Services.AddOpenTelemetry() .ConfigureResource(resource => resource.AddService("sample-api")) .WithMetrics(metrics => { metrics.AddAspNetCoreInstrumentation(); metrics.AddOtlpExporter(options => options.Endpoint = endpoint); }) .WithTracing(tracing => { tracing.AddAspNetCoreInstrumentation(); tracing.AddHttpClientInstrumentation(); tracing.AddOtlpExporter(options => options.Endpoint = endpoint); });
var app = builder.Build();
app.MapGet("/", () => "The app is sending telemetry.");
app.Run();Point OTEL_EXPORTER_OTLP_ENDPOINT at the dashboard’s OTLP receiver. The receiver address depends on how you started the dashboard, so use the endpoint printed by your Aspire setup. The example’s localhost:4317 is a common local OTLP gRPC address, not a promise that every dashboard listens there.
What You’ll See
The ASP.NET Core instrumentation records incoming requests. The HTTP client instrumentation records outgoing requests. The logging provider forwards logs, while the metrics and tracing providers send their own signals.
You can add your own meters and activity sources once the built in signals are flowing.
Key Takeaway
The Aspire Dashboard is useful beyond Aspire orchestration. If your app can export OTLP, it can send its logs, metrics, and traces there.