Skip to main content

Kedi OpenTelemetry Instrumentation

opentelemetry-instrumentation-kedi connects Kedi's dependency-free telemetry seam to OpenTelemetry. Importing Kedi remains a no-op; telemetry starts only after the instrumentor is enabled.

Installation

From a Kedi source checkout with its submodules initialized:

uv sync --project kedi-otel --locked

This installs the checked-out Kedi runtime and instrumentor into kedi-otel/.venv. Run the application in that environment. Add --extra httpx when using HTTPX instrumentation. To install into an existing compatible environment instead, use python -m pip install -e ./kedi-otel from the Kedi repository root. Kedi >=0.1.1,<0.2 must already be available in that environment or from the package index.

Usage

from opentelemetry.instrumentation.kedi import KediInstrumentor

KediInstrumentor().instrument()

Configure the application's tracer and meter providers with service.name=kedi. Kedi does not replace the application's SDK, sampler, resource, exporter, or Logfire configuration.

Configuration

All boolean options require actual bool values. Unknown option names and invalid types raise immediately instead of silently weakening telemetry policy.

KediInstrumentor().instrument(
    runtime_detail="lifecycle",  # "off", "lifecycle", or "detailed"
    agent_enabled=True,
    artifacts_enabled=True,
    capture_content=False,
    capture_binary_content=False,
    capture_source_paths=False,
    capture_source_snippets=False,
    capture_model_request_parameters=False,
    capture_tool_definitions=False,
    capture_exception_messages=False,
    capture_exception_stacktraces=False,
    max_metric_instruments=128,
    instrument_pydantic_ai=True,
    instrument_httpx=False,
    tracer_provider=tracer_provider,
    meter_provider=meter_provider,
)

agent_enabled controls the complete agent surface, including model and tool calls, MCP initialization, approvals, subagents, dynamic workflows, and CodeMode discovery and execution. CodeMode emits payload-free search tools, get tool schema, and execute code spans in the kedi.agent instrumentation scope, plus kedi.codemode.operations and kedi.codemode.duration metrics.

Content, binary content, source paths, source snippets, model request parameters, tool definitions, exception messages, and exception stack traces are separate privacy classes. All are disabled by default. Exception type remains observable; message and stack data require their respective explicit opt-ins and are bounded.

Pydantic AI instrumentation is enabled by default. Kedi filters model request parameters and tool definitions before they reach the configured tracer provider unless their dedicated capture options are enabled. Pydantic's process-wide instrumentation setting is restored only while Kedi still owns the exact setting; a newer application owner is never overwritten.

HTTPX instrumentation requires the httpx extra and explicit instrument_httpx=True. Enabling it is a one-way, application-owned setup action. Kedi deliberately does not call global HTTPX uninstrument() because the upstream instrumentor exposes no owner token and teardown could remove another library's instrumentation.

Lifecycle

Instrumentation transitions are serialized and idempotent. Teardown attempts every owned cleanup step even when one fails, restores the Kedi backend with an owner-aware compare-and-restore operation, and raises KediInstrumentationCleanupError with all cleanup causes. If setup itself fails, the setup exception remains primary and any rollback failure is chained beneath it.

Metadata

Release files for opentelemetry-instrumentation-kedi 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for opentelemetry-instrumentation-kedi 0.1.0
File Size Uploaded Provenance Actions
opentelemetry_instrumentation_kedi-0.1.0.tar.gz 93.3 kB Without provenance Details for opentelemetry_instrumentation_kedi-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for opentelemetry-instrumentation-kedi 0.1.0
File Interpreter ABI Platform Actions
opentelemetry_instrumentation_kedi-0.1.0-py3-none-any.whl Python 3 none any Details for opentelemetry_instrumentation_kedi-0.1.0-py3-none-any.whl

Total release size: 104.6 kB

Release files / opentelemetry_instrumentation_kedi-0.1.0.tar.gz

Download URL opentelemetry_instrumentation_kedi-0.1.0.tar.gz
Size 93.3 kB
Tags Source
SHA-256 checksum
How to use checksums
7f37b1403d327350fca98f8ebd2404ffc6deb328d252ebdf9bbb26a7beaa461e
BLAKE2b-256 checksum
How to use checksums
2eab9caa2c321da7cdf881a1f11cc33f6f6bc209ec33beed4a924f415f8a3990
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.6

Release files / opentelemetry_instrumentation_kedi-0.1.0-py3-none-any.whl

Download URL opentelemetry_instrumentation_kedi-0.1.0-py3-none-any.whl
Size 11.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
391f4e46b7c172dea76ea7ec8196aa10a9520fbf16ee009c6c60c7c7ede2ec74
BLAKE2b-256 checksum
How to use checksums
9dcacbcafc0031bbf3b3668468bfa29d251759b98fc8f55ce314fe402320f13c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.6

Security for opentelemetry-instrumentation-kedi 0.1.0

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A 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.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page