Skip to content

Change Python OTEL configuration to environment variables #11878

Closed

Description

Is there an existing issue for this?

  • I have searched the existing issues

Is your feature request related to a problem? Please describe the problem.

OTEL for Python is discovered via the entrypoint program opentelemetry-instrument https://github.com/dotnet/aspire/blob/main/src/Aspire.Hosting.Python/PythonAppResourceBuilderExtensions.cs#L171-L181 and then launched directly via this executable.

This implementation means that the opentelemetry package must be installed before launching a python application via aspire and you cannot have a linked python environment sub-resource.

Describe the solution you'd like

Instead, the environment variables should be passed along for the exporter configurations of Metrics, Logging and Traces.

https://opentelemetry.io/docs/specs/otel/configuration/sdk-environment-variables/#exporter-selection

OTEL_TRACES_EXPORTER = otlp
OTEL_LOGS_EXPORTER = otlp,console
OTEL_METRICS_EXPORTER = otlp

The existing OTEL_EXPORTER_OTLP_ENDPOINT (http://localhost:4317 by default) environment variable should be picked up, along with OTEL_EXPORTER_OTLP_INSECURE (false by default)

Additional context

No response

Activity

  1. tonybaloney commented on Oct 7, 2025

    @tonybaloney
    Author

    Also, this should follow the same pattern as the .NET projects and be part of Service Defaults, or at least be optional. Some production apps would have an existing exporter like the Azure or Prometheus exporter and having Aspire suddenly override this would be surprising.

  2. added this to the 13.0 milestone on Oct 7, 2025
  3. davidfowl commented on Oct 15, 2025

    @davidfowl
    Collaborator

    This is "fixed". Service defaults work will be part of the python template #11865

  4. locked and limited conversation to collaborators on Nov 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area-telemetryTelemetry from the Aspire app to the dashboardpython

Type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions