An OpenTelemetry distro which automatically discovers container attributes from the environment. This distribution extends the standard `opentelemetry-distro` to automatically include additional resource detectors tailored for container environments, such as Docker or Kubernetes. It aims to simplify OpenTelemetry setup by providing automatic configuration, while largely preserving the behavior of `opentelemetry-distro`. The current version is 0.2.0, released on September 18, 2022, indicating a slower release cadence compared to core OpenTelemetry components.
pip install opentelemetry-container-distroVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to use the `opentelemetry-container-distro` by simply installing it and then interacting with the standard OpenTelemetry Python API. The key takeaway is how to retrieve and inspect the resource attributes, which should automatically include container-specific metadata if the application is running within a recognized container environment (e.g., Docker, Kubernetes). An OpenTelemetry Collector is typically needed to receive and export telemetry data.
Ensure an OpenTelemetry Collector is running and correctly configured to receive OTLP data (gRPC default on port 4317, HTTP on 4318). Regularly check Collector release notes for breaking changes and update image references (e.g., from `otel/opentelemetry-collector-contrib` to `ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector-contrib`).
When running in a container, ensure the Docker socket is mounted (e.g., `-v /var/run/docker.sock:/var/run/docker.sock`) or that the execution environment grants the necessary permissions and access to container metadata APIs (e.g., ECS task metadata endpoint for AWS ECS).
Monitor the project's GitHub repository for new releases. If using the latest OpenTelemetry SDK features is critical, users might need to manually configure resource detectors or consider a more actively maintained OpenTelemetry distribution, or contribute to updating this distro.
Understand that the distro's role is to pre-configure the global OpenTelemetry SDK components. After installation, applications should interact with OpenTelemetry using its standard APIs (e.g., `from opentelemetry import trace`). Refer to the `opentelemetry-distro` documentation for general usage patterns if explicit configuration is needed beyond defaults.