otlp-json
otpl-json is an OTLP serialisation library.
It's written in pure Python, without dependencies.
It serialises a bunch of spans into OTLP 1.5 JSON format.
Motivation
Tracing should be on by default.
OTLP is the standard data format and API, and the standard Python package is opentelemetry-exporter-otlp-proto-http. It brings in a total of 18 packages and adds 9MB to the project virtual environment.
A typical Python application, that's being instrumented, only generates own tracing data and needs to send it out. It doesn't need that much complexity.
Usage
from otlp_json import CONTENT_TYPE, encode_spans
class SomeExporter:
def export(self.spans: Sequece[ReadableSpan]) -> None:
requests.post(
"http://localhost:4318/v1/traces",
data=encode_spans(spans),
headers={"Content-Type": CONTENT_TYPE},
)
Library size
- 3KB whl, containing:
- 4KB Python source
- ?? metadata
Testing
uv sync
uv run pytest
Links
- Test data generator: https://pypi.org/project/otlp-test-data/
- Python stdlib-only exporter: https://github.com/canonical/operator/blob/main/tracing/ops_tracing/_export.py#L141-L160
- Tiny (compiled) extension written in Rust: https://pypi.org/project/otlp-proto
Features
- Events
- Links
- Baggage
- Schemata, when https://github.com/open-telemetry/opentelemetry-python/pull/4359 lands
TODO(fixes)
- Status fields
- validate what fields are in fact optional
- ???
Limitations
This library is meant to marshal tracing data that's collected in the same Python process.
It is not meant to be used for data received and forwarded.
Metadata
Release files for otlp-json 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| otlp_json-1.0.1.tar.gz | 47.0 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| otlp_json-1.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 51.4 kB
Release files / otlp_json-1.0.1.tar.gz
| Download URL | otlp_json-1.0.1.tar.gz |
|---|---|
| Size | 47.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1f51dd53f71ba7effc94e383e59f58aea5f257a591dcc3ec05d4d0ffa6921e24
|
|
BLAKE2b-256 checksum How to use checksums |
03fd8c19154b754182747d96bda8e142295c91af3c6681d9daf42fe67afc4d88
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Feb 5, 2026.
Transparency logRelease files / otlp_json-1.0.1-py3-none-any.whl
| Download URL | otlp_json-1.0.1-py3-none-any.whl |
|---|---|
| Size | 4.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a25e7c1453aa5c197eac5abd657b1a0d453c0b94ef6663d7776f4d25a9715a30
|
|
BLAKE2b-256 checksum How to use checksums |
87fc8abbbf8f7718da0e547f640fc1e0726f49a5560d69730e43590469361d54
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Feb 5, 2026.
Transparency logSecurity for otlp-json 1.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for otlp_json-1.0.1.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Feb 5, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.