-
Notifications
You must be signed in to change notification settings - Fork 850
Description
Is there an existing issue for this?
- I have searched the existing issues
Describe the bug
Setting the OTEL endpoint via WithEnvironment is reflected in the Aspire Dashboard, but the application ignores it at runtime. For example:
builder.AddProject<Api>("weather-api") .WithEnvironment("OTEL_EXPORTER_OTLP_ENDPOINT","http://localhost:4317");
Dashboard shows http://localhost:4317 for OTEL_EXPORTER_OTLP_ENDPOINT
Runtime actually uses a different endpoint like http://localhost:62312
This prevents redirecting traces to a custom OTEL collector.
Notes:
I have not called AddOpenTelemetryCollector(...), per previous feedback (#11298) that WithEnvironment should suffice. It's not needed to reproduce the problem. However if used, the behaviour is exactly the same.
The discrepancy is between what Aspire reports and the actual environment in the running app.
Repo for reproduction: AspireOtelDemo
Expected Behavior
WithEnvironment should respect the configured OTEL endpoint
Steps To Reproduce
As Above
Exceptions (if any)
None
.NET Version info
9 & 10
Anything else?
None