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

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.1
File Size Uploaded Provenance Actions
opentelemetry_instrumentation_kedi-0.1.1.tar.gz 93.5 kB Without provenance Details for opentelemetry_instrumentation_kedi-0.1.1.tar.gz

Built distribution (wheel)

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

Total release size: 104.9 kB

Release files / opentelemetry_instrumentation_kedi-0.1.1.tar.gz

Download URL opentelemetry_instrumentation_kedi-0.1.1.tar.gz
Size 93.5 kB
Tags Source
SHA-256 checksum
How to use checksums
f52f066e8a9667a5c6f0954653257d6aa12fb6f03ba60d708939bfa11a648ff1
BLAKE2b-256 checksum
How to use checksums
5923f80177717d819fef6a2c02fc146ce34c62871253db16b94d6e4e96181e51
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.1-py3-none-any.whl

Download URL opentelemetry_instrumentation_kedi-0.1.1-py3-none-any.whl
Size 11.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
93779e4aa31f1ccc3a293ca4cf09c51075efb31e43eefacb1b8a2d386aa8a108
BLAKE2b-256 checksum
How to use checksums
539cc5e91735ba6dc5f904d3224d992d4c09699a94c7a19952cf40f379922a49
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.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.

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