OpenTelemetry auto-instrumentation for Python applications using sitecustomize
Project description
OpenTelemetry SiteCustomize Instrumentation
Automatic OpenTelemetry instrumentation via Python's sitecustomize mechanism. Designed for environments where modifying the application startup command is difficult or impossible: managed runtimes, serverless platforms, job schedulers, and similar constrained settings. Install the package and instrumentation is applied automatically at Python startup, no wrapper command required.
When to Use This
The opentelemetry-instrument CLI is the standard way to auto-instrument a Python application. This package is for situations where wrapping your command with the CLI is not feasible, or requires tedious workarounds.
Note: If you control your application's startup command, prefer the
opentelemetry-instrumentCLI. This package is specifically designed for cases where that is not practical.
Installation
pip install opentelemetry-sitecustomize
or
uv add opentelemetry-sitecustomize
You will also need to install the OpenTelemetry instrumentors for the libraries you use. For example:
pip install opentelemetry-instrumentation-flask opentelemetry-instrumentation-requests
Usage
With the package installed, simply run your application as usual:
python app.py
No need for:
opentelemetry-instrument python app.py
OpenTelemetry instrumentation is applied automatically at Python startup.
Configuration
This package uses the same initialization path as the opentelemetry-instrument CLI, so all standard OpenTelemetry environment variables apply:
OTEL_SERVICE_NAME- set the service name for your tracesOTEL_TRACES_EXPORTER- choose the trace exporter (e.g.,otlp,console,none)OTEL_METRICS_EXPORTER- choose the metrics exporterOTEL_LOGS_EXPORTER- choose the logs exporterOTEL_EXPORTER_OTLP_ENDPOINT- set the OTLP collector endpointOTEL_PYTHON_DISABLED_INSTRUMENTATIONS- comma-separated list of instrumentations to skip
See the OpenTelemetry Python documentation for the full list of supported environment variables.
How It Works
This package registers a sitecustomize entrypoint that calls opentelemetry.instrumentation.auto_instrumentation:initialize during Python's site initialization. This is the same initialization function used by the opentelemetry-instrument CLI, but triggered automatically via the sitecustomize-entrypoints library.
Requirements
- Python >= 3.9
- sitecustomize-entrypoints ~= 1.0
- opentelemetry-api >= 1.25
- opentelemetry-instrumentation >= 0.46b0
License
Apache-2.0
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file opentelemetry_sitecustomize-0.1.0.tar.gz.
File metadata
- Download URL: opentelemetry_sitecustomize-0.1.0.tar.gz
- Upload date:
- Size: 6.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ef1c747342f4edb5060159e38a1ae2d1fe35667af84e3124d911123c17f546b0
|
|
| MD5 |
cb1297d88a08e4a211ae0d6afb912236
|
|
| BLAKE2b-256 |
dabdbfde2da5d93aed482db2c19addc41d065bd9eca4fbac8267ea8b08f8044e
|
Provenance
The following attestation bundles were made for opentelemetry_sitecustomize-0.1.0.tar.gz:
Publisher:
publish.yml on herin049/opentelemetry-sitecustomize
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
opentelemetry_sitecustomize-0.1.0.tar.gz -
Subject digest:
ef1c747342f4edb5060159e38a1ae2d1fe35667af84e3124d911123c17f546b0 - Sigstore transparency entry: 1194669135
- Sigstore integration time:
-
Permalink:
herin049/opentelemetry-sitecustomize@6214ff43e821e817eda9added02f4351f46976ce -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/herin049
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@6214ff43e821e817eda9added02f4351f46976ce -
Trigger Event:
release
-
Statement type:
File details
Details for the file opentelemetry_sitecustomize-0.1.0-py3-none-any.whl.
File metadata
- Download URL: opentelemetry_sitecustomize-0.1.0-py3-none-any.whl
- Upload date:
- Size: 7.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5d467634f5d611a44c474ccf3f1cd9380d3bfbbf350f8f233554190348374d5c
|
|
| MD5 |
ea1a09184f6586a70b175ded822a4157
|
|
| BLAKE2b-256 |
bf71eb207e9b84910f39fd5b5c05042d8e8f083ea572f0c8b2fc9e00b7e84221
|
Provenance
The following attestation bundles were made for opentelemetry_sitecustomize-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on herin049/opentelemetry-sitecustomize
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
opentelemetry_sitecustomize-0.1.0-py3-none-any.whl -
Subject digest:
5d467634f5d611a44c474ccf3f1cd9380d3bfbbf350f8f233554190348374d5c - Sigstore transparency entry: 1194669147
- Sigstore integration time:
-
Permalink:
herin049/opentelemetry-sitecustomize@6214ff43e821e817eda9added02f4351f46976ce -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/herin049
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@6214ff43e821e817eda9added02f4351f46976ce -
Trigger Event:
release
-
Statement type: