microsoft / microsoft/aspire

OpenTelemetry Traceparent Propagation from Container to Aspire AppHost

Open
#13,163 7 comments 0 reactions 0 assignees View on GitHub
needs-area-label
Dominant language
C#
Stars
6.3k
Forks
991
Avg merge
2d 12h
Merged PRs (30d)
201

Description

Aspire AppHost (main solution):
```
var builder = DistributedApplication.CreateBuilder(args);
var env = builder.AddDockerComposeEnvironment("docker-compose")
.ConfigureComposeFile(f =>
{
// other stuff
});

// Some other projects connected as AddProject (works fine)

var testContainer = builder.AddContainer("test", "container_address", "master")
.WithOtlpExporter()
.PublishAsDockerComposeService((resource, service) =>
{
service.ExtraHosts = new()
{
{"host.docker.internal", "host-gateway"}
};
})
.WithComputeEnvironment(env);

builder.Build().Run();
```

TestContainer Program.cs (separate project):
```
var builder = Host.CreateApplicationBuilder(args);

builder.Logging.AddOpenTelemetry(options =>
{
options.IncludeScopes = true;
options.IncludeFormattedMessage = true;
});

builder.Services.AddOpenTelemetry()
.WithMetrics(metrics =>
{
metrics.AddMeter("BaseMeter");
})
.WithTracing(tracingBuilder =>
{
tracingBuilder
.AddSource("BaseSource")
.AddHttpClientInstrumentation();
})
.UseOtlpExporter();
```

What am I doing wrong? Why don’t I see Tracing/Metrics from TestContainer in the Aspire AppHost Dashboard?

Contributor guide

Open the contributing guide

Research direction

Start with the Aspire AppHost configuration and the separate TestContainer Program.cs shown in the issue. Trace how the OTLP exporter and Docker Compose environment are configured, then verify the resulting container telemetry against the Aspire AppHost Dashboard; done means the TestContainer's traces and metrics appear there.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, docker, docker-compose
Domain
devops, observability
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.