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

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.2
File Size Uploaded Provenance Actions
opentelemetry_instrumentation_kedi-0.1.2.tar.gz 139.1 kB Without provenance Details for opentelemetry_instrumentation_kedi-0.1.2.tar.gz

Built distribution (wheel)

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

Total release size: 151.7 kB

Release files / opentelemetry_instrumentation_kedi-0.1.2.tar.gz

Download URL opentelemetry_instrumentation_kedi-0.1.2.tar.gz
Size 139.1 kB
Tags Source
SHA-256 checksum
How to use checksums
b462674b7dcbc875cc7fd9b666839d8c946519a7b8e01c06995d38f0bf067631
BLAKE2b-256 checksum
How to use checksums
cb89c0505dfbf5e2d58a94ab2d426065e3cc57b7ee595195c9fe2f40045b97e6
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.2-py3-none-any.whl

Download URL opentelemetry_instrumentation_kedi-0.1.2-py3-none-any.whl
Size 12.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2ed4da2d867fd406dfe83f047a883aa5d4f8a2c55f26aa834e62bda21d00ad62
BLAKE2b-256 checksum
How to use checksums
59eee77b765b383e0f9db7a2cc706ad558a691209bbfa2f462e71631a46e1d77
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.2

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