Skip to main content

🐍Lightweight OTEL span to JSON converter, no dependencies, pure Python🐍

Project description

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

Features

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

otlp_json-1.0.1.tar.gz (47.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

otlp_json-1.0.1-py3-none-any.whl (4.4 kB view details)

Uploaded Python 3

File details

Details for the file otlp_json-1.0.1.tar.gz.

File metadata

  • Download URL: otlp_json-1.0.1.tar.gz
  • Upload date:
  • Size: 47.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for otlp_json-1.0.1.tar.gz
Algorithm Hash digest
SHA256 1f51dd53f71ba7effc94e383e59f58aea5f257a591dcc3ec05d4d0ffa6921e24
MD5 0e82aae1e681b0c56e1c802205a0dbd7
BLAKE2b-256 03fd8c19154b754182747d96bda8e142295c91af3c6681d9daf42fe67afc4d88

See more details on using hashes here.

Provenance

The following attestation bundles were made for otlp_json-1.0.1.tar.gz:

Publisher: ci.yaml on dimaqq/otlp-json

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file otlp_json-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: otlp_json-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 4.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for otlp_json-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a25e7c1453aa5c197eac5abd657b1a0d453c0b94ef6663d7776f4d25a9715a30
MD5 e73aa67df0a4bb49207b5af85d3d4d65
BLAKE2b-256 87fc8abbbf8f7718da0e547f640fc1e0726f49a5560d69730e43590469361d54

See more details on using hashes here.

Provenance

The following attestation bundles were made for otlp_json-1.0.1-py3-none-any.whl:

Publisher: ci.yaml on dimaqq/otlp-json

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page