Skip to main content

Ratel telemetry conventions — the ratel.* overlay on OpenTelemetry gen_ai spans. init() helper and constants for the Ratel context engineering platform.

Project description

ratel-ai-telemetry (Python)

The ratel.* telemetry helper for Python: the constants that codify the Tier 2 overlay of ../CONVENTIONS.md (attribute keys, span/event names, the Origin/SearchTarget/AuthOutcome value enums, the pinned semconv version), plus init() sugar over the standard OpenTelemetry Python SDK. init() wires an OTLP http/protobuf exporter to RATEL_URL (or endpoint=/headers=) and returns the provider as a shutdown handle; a caller already running the OTel SDK skips it and takes only the constants. This package adds no custom transport, no native binding, no schema (ADR-0015).

Usage

from opentelemetry import trace
from ratel_ai_telemetry import (
    EXECUTE_TOOL,
    GEN_AI_OPERATION_NAME,
    GEN_AI_TOOL_NAME,
    RATEL_ORIGIN,
    Origin,
    init,
)

# Wire the OTLP exporter to RATEL_URL once at startup (or pass endpoint=/headers=).
provider = init(api_key="sk-...")

# Emit a standard gen_ai `execute_tool` span enriched with the ratel.* overlay.
span = trace.get_tracer("my-agent").start_span(
    EXECUTE_TOOL,
    attributes={
        GEN_AI_OPERATION_NAME: EXECUTE_TOOL,
        GEN_AI_TOOL_NAME: "send_email",
        RATEL_ORIGIN: Origin.AGENT.value,
    },
)
span.end()

provider.shutdown()  # flush the exporter on exit

Already running the OTel SDK? Skip init() and take only the constants. A complete, offline-runnable version (console exporter + a ratel.searchexecute_tool trace) is in examples/telemetry-python.

Package shape

  • Distribution name: ratel-ai-telemetry; import name: ratel_ai_telemetry
  • Pure Python (hatchling build, no Rust extension); depends on the OpenTelemetry Python SDK for init()
  • Targets Python >=3.9 (the OTel deps are pinned below 1.42, the last line supporting 3.9)
  • Released under the telemetry-py-v* tag prefix (ADR-0016)
  • MIT (ADR-0017)

Build & test

From this directory (needs uv):

uv venv --python 3.11 .venv
uv pip install --python .venv -e '.[dev]'
.venv/bin/ruff check . && .venv/bin/mypy ratel_ai_telemetry && .venv/bin/pytest

Unlike the Python SDK there is no maturin develop step — the package is pure Python, installed editable. The tests cover the vocabulary (each constant asserted against the pin), init()'s endpoint/auth resolution and the content-capture gate, and the shared contract-against-the-pin conformance in ../conformance/ (spans built from these constants through the real SDK must emit the exact pinned keys).

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

ratel_ai_telemetry-0.1.0rc2.tar.gz (10.0 kB view details)

Uploaded Source

Built Distribution

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

ratel_ai_telemetry-0.1.0rc2-py3-none-any.whl (8.9 kB view details)

Uploaded Python 3

File details

Details for the file ratel_ai_telemetry-0.1.0rc2.tar.gz.

File metadata

  • Download URL: ratel_ai_telemetry-0.1.0rc2.tar.gz
  • Upload date:
  • Size: 10.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for ratel_ai_telemetry-0.1.0rc2.tar.gz
Algorithm Hash digest
SHA256 68a8aa2109f47ff068019eb9e973182747acd60be26dc04423534756d2341d6e
MD5 4a2c759ba4b0b8f19b7b057af166e858
BLAKE2b-256 328a6ebc9ff3483d8cfdb70399d71d8bb658edbf47d05af8472e45660d7e813a

See more details on using hashes here.

Provenance

The following attestation bundles were made for ratel_ai_telemetry-0.1.0rc2.tar.gz:

Publisher: release.yml on ratel-ai/ratel

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

File details

Details for the file ratel_ai_telemetry-0.1.0rc2-py3-none-any.whl.

File metadata

File hashes

Hashes for ratel_ai_telemetry-0.1.0rc2-py3-none-any.whl
Algorithm Hash digest
SHA256 ec0320f27b743cae973d966ca28eb38d420f282de7ea1747167728f0f36fc311
MD5 a1ee0c8291116bbaad644cf232a8e705
BLAKE2b-256 fefa06d03f933f58a022e2fbc96140eb4246557a193cecdeba5e905371b3885c

See more details on using hashes here.

Provenance

The following attestation bundles were made for ratel_ai_telemetry-0.1.0rc2-py3-none-any.whl:

Publisher: release.yml on ratel-ai/ratel

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