Registry / observability / opentelemetry-instrumentation-writer

opentelemetry-instrumentation-writer

JSON →
library0.62.3pypypi✓ verified 22d ago

This package provides OpenTelemetry instrumentation for the internal `writer` module within the Traceloop SDK. It helps capture tracing data related to text generation and other 'write' operations performed by the `traceloop-sdk`. It's part of the broader OpenLLMetry project, focusing on observability for LLM applications. Releases are frequent, often several times a week, aligning with the rapid development of the OpenLLMetry ecosystem.

pip install opentelemetry-instrumentation-writer
INSTALL
IMPORT
SIG · OPENTELEMETRY-INST
O
opentelemetry-instrumentation-writer
observabilitypythonv0.62.3
Install
2.6s avg
Import
Disk
22MB
Pass rate
8/ 10
Env Coverage8 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.62.3 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
glibc
py 3.10
✓ —
✓ 2.8s
py 3.11
✓ —
✓ 2.7s
py 3.12
✓ —
✓ 2.5s
py 3.13
✓ —
✓ 2.4s
py 3.9
✕ build_error
✕ build_error
22MB installed
● package 22MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

WriterInstrumentor
from opentelemetry.instrumentation.writer import WriterInstrumentor
from opentelemetry.instrumentation.writer import WriterInstrumentor

This quickstart demonstrates how to manually initialize OpenTelemetry, enable the `WriterInstrumentor`, and explains that traces will be generated when the `traceloop-sdk`'s internal `writer` module is used. This instrumentation is typically part of the broader `Traceloop.init()` setup, but can be enabled standalone.

from opentelemetry import trace from opentelemetry.sdk.resources import Resource from opentelemetry.sdk.trace import TracerProvider from opentelemetry.sdk.trace.export import ConsoleSpanExporter, SimpleSpanProcessor # NOTE: This instrumentation requires 'traceloop-sdk' to be installed # and its internal 'writer' components to be used to generate traces. # You would typically install it via `pip install traceloop-sdk`. # Optional: Also install a specific LLM library like openai, anthropic, etc. # e.g., pip install opentelemetry-instrumentation-openai # 1. Import the specific instrumentation from opentelemetry.instrumentation.writer import WriterInstrumentor # 2. Set up a basic OpenTelemetry TracerProvider and Exporter resource = Resource.create({"service.name": "my-traceloop-writer-app"}) provider = TracerProvider(resource=resource) processor = SimpleSpanProcessor(ConsoleSpanExporter()) provider.add_span_processor(processor) trace.set_tracer_provider(provider) # 3. Instrument the target library WriterInstrumentor().instrument() # 4. Now, if `traceloop-sdk` is used, operations involving its internal # 'writer' module (e.g., handling LLM inputs/outputs) will generate spans. # For example, if you were using `traceloop-sdk` to wrap an OpenAI call: # # from traceloop.sdk import Traceloop # from openai import OpenAI # Traceloop.init(app_name="my-llm-app", disable_batch=True) # Enables ALL Traceloop instrumentations # client = OpenAI() # response = client.chat.completions.create( # model="gpt-3.5-turbo", messages=[{"role": "user", "content": "Hello"}] # ) # print(response.choices[0].message.content) print("OpenTelemetry Writer Instrumentation enabled. Traces will appear when traceloop-sdk 'writer' module is invoked.")
Debug
Known issues
gotchaThis instrumentation package explicitly depends on and instruments components of the `traceloop-sdk`. Installing `opentelemetry-instrumentation-writer` alone will not generate any traces unless `traceloop-sdk` is also installed and actively used within your application.
fix
Ensure `traceloop-sdk` is installed (`pip install traceloop-sdk`) and integrated into your LLM application for this instrumentation to have an effect.
affects: All versions
breakingThe OpenTelemetry Generative AI Semantic Conventions are evolving rapidly. This means that span attribute names, types, and structures emitted by this instrumentation can change frequently between minor and even patch versions, requiring updates to any custom trace processing or analysis logic.
fix
Regularly consult the OpenTelemetry GenAI Semantic Conventions documentation and the `openllmetry` release notes. Update your trace consumers and dashboards to reflect the latest attribute specifications.
affects: 0.53.0 and newer (and likely future versions)
gotchaThe `WriterInstrumentor` targets `traceloop.sdk.tracing.writer.WriterModule`, which is an internal component of `traceloop-sdk`. Users typically do not directly interact with `WriterModule`. Traces are generated implicitly when using `traceloop-sdk`'s higher-level functionalities, such as LLM wrappers or agents.
fix
Understand that this instrumentation operates at a low level within the `traceloop-sdk`. To see its effects, integrate and use `traceloop-sdk` as documented, and observe the resulting spans rather than trying to directly invoke the `WriterModule`.
affects: All versions
Upgrade
Version history
0.62.3latest on PyPI · released Aug 10, 2026
Audit
Dependencies
opentelemetry-apirequiredCore OpenTelemetry API for defining traces.
opentelemetry-sdkrequiredCore OpenTelemetry SDK for trace implementation.
wraptrequiredUsed for robust monkey patching to instrument target libraries.
traceloop-sdkrequiredThis instrumentation targets an internal component of `traceloop-sdk`. It is required for any traces to be generated.
Agent activity
25 hits · last 30 days
node
22
Amazon
1
OpenAI (training)
1
Resources
opentelemetry-instrumentation-writer — pip install opentelemetry-instrumentation-writer · libregistry