Component ยท Data side
python-instrumentation-provider (init container)
What it is
python-instrumentation-provider is an init container image, a small container that runs before an agent's main container starts. It copies the OpenTelemetry and Traceloop packages and a file called sitecustomize.py into a volume shared with the agent pod. The agent pod puts that volume on its PYTHONPATH, so Python loads the instrumentation at startup without any change to the agent's code.
It is a mechanic who fits a tracker under your car while you are still in the garage, then leaves before you drive off.
Why it exists
Platform-hosted Python agents should be traced automatically. An init container does it without asking agent authors to install or import anything.
How it works
- The OpenChoreo trait python-otel-instrumentation-trait adds the init container to the pod and sets PYTHONPATH for the agent container. It is attached only to Python buildpack agents that have auto-instrumentation turned on.
- The init container runs setup-instrumentation.py, which copies the packages and sitecustomize.py into the shared volume at /otel-tracing-sdk.
- At startup Python imports sitecustomize.py, which reads AMP_OTEL_ENDPOINT and AMP_AGENT_API_KEY and calls Traceloop.init with the header x-amp-api-key.
- If a variable is missing or setup fails, the error is logged and the agent keeps running without tracing. The init step must not break the agent.
- The image holds locked dependency sets for each pair of Traceloop version and Python version.
Identity and access
It exports with the agent's API key in the x-amp-api-key header.
Key facts
- Form
- Kubernetes init container image
- Shared volume path
- /otel-tracing-sdk
- Bootstrap file
- sitecustomize.py
- Settings read
- AMP_OTEL_ENDPOINT, AMP_AGENT_API_KEY
- On failure
- Logs the error, agent still starts
- Runs in
- The agent pod, on the data plane
- Namespace
- agent pod
Inside and around
Contains: Agent workload (internal)