{"library":"opentelemetry-instrumentation-writer","title":"OpenTelemetry Writer Instrumentation for Traceloop SDK","description":"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.","language":"python","status":"active","last_verified":"Fri May 15","install":{"commands":["pip install opentelemetry-instrumentation-writer"],"cli":null},"imports":["from opentelemetry.instrumentation.writer import WriterInstrumentor"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"from opentelemetry import trace\nfrom opentelemetry.sdk.resources import Resource\nfrom opentelemetry.sdk.trace import TracerProvider\nfrom opentelemetry.sdk.trace.export import ConsoleSpanExporter, SimpleSpanProcessor\n\n# NOTE: This instrumentation requires 'traceloop-sdk' to be installed\n# and its internal 'writer' components to be used to generate traces.\n# You would typically install it via `pip install traceloop-sdk`.\n\n# Optional: Also install a specific LLM library like openai, anthropic, etc.\n# e.g., pip install opentelemetry-instrumentation-openai\n\n# 1. Import the specific instrumentation\nfrom opentelemetry.instrumentation.writer import WriterInstrumentor\n\n# 2. Set up a basic OpenTelemetry TracerProvider and Exporter\nresource = Resource.create({\"service.name\": \"my-traceloop-writer-app\"})\nprovider = TracerProvider(resource=resource)\nprocessor = SimpleSpanProcessor(ConsoleSpanExporter())\nprovider.add_span_processor(processor)\ntrace.set_tracer_provider(provider)\n\n# 3. Instrument the target library\nWriterInstrumentor().instrument()\n\n# 4. Now, if `traceloop-sdk` is used, operations involving its internal\n#    'writer' module (e.g., handling LLM inputs/outputs) will generate spans.\n#    For example, if you were using `traceloop-sdk` to wrap an OpenAI call:\n#\n# from traceloop.sdk import Traceloop\n# from openai import OpenAI\n# Traceloop.init(app_name=\"my-llm-app\", disable_batch=True) # Enables ALL Traceloop instrumentations\n# client = OpenAI()\n# response = client.chat.completions.create(\n#    model=\"gpt-3.5-turbo\", messages=[{\"role\": \"user\", \"content\": \"Hello\"}]\n# )\n# print(response.choices[0].message.content)\n\nprint(\"OpenTelemetry Writer Instrumentation enabled. Traces will appear when traceloop-sdk 'writer' module is invoked.\")\n","lang":"python","description":"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.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":{"tag":null,"tag_description":null,"last_tested":"2026-05-15","installed_version":"0.60.0","pypi_latest":"0.60.0","is_stale":false,"summary":{"python_range":"3.10–3.9","success_rate":80,"avg_install_s":2.5,"avg_import_s":null,"wheel_type":"wheel"},"results":[{"runtime":"python:3.10-alpine","python_version":"3.10","os_libc":"alpine (musl)","variant":"opentelemetry-instrumentation-writer","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":"24.3M"},{"runtime":"python:3.10-slim","python_version":"3.10","os_libc":"slim (glibc)","variant":"opentelemetry-instrumentation-writer","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":2.8,"import_time_s":null,"mem_mb":null,"disk_size":"25M"},{"runtime":"python:3.11-alpine","python_version":"3.11","os_libc":"alpine (musl)","variant":"opentelemetry-instrumentation-writer","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":"26.8M"},{"runtime":"python:3.11-slim","python_version":"3.11","os_libc":"slim (glibc)","variant":"opentelemetry-instrumentation-writer","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":2.7,"import_time_s":null,"mem_mb":null,"disk_size":"27M"},{"runtime":"python:3.12-alpine","python_version":"3.12","os_libc":"alpine (musl)","variant":"opentelemetry-instrumentation-writer","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":"18.5M"},{"runtime":"python:3.12-slim","python_version":"3.12","os_libc":"slim (glibc)","variant":"opentelemetry-instrumentation-writer","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":2.4,"import_time_s":null,"mem_mb":null,"disk_size":"19M"},{"runtime":"python:3.13-alpine","python_version":"3.13","os_libc":"alpine (musl)","variant":"opentelemetry-instrumentation-writer","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":"18.2M"},{"runtime":"python:3.13-slim","python_version":"3.13","os_libc":"slim (glibc)","variant":"opentelemetry-instrumentation-writer","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":2.3,"import_time_s":null,"mem_mb":null,"disk_size":"19M"},{"runtime":"python:3.9-alpine","python_version":"3.9","os_libc":"alpine (musl)","variant":"opentelemetry-instrumentation-writer","exit_code":1,"wheel_type":null,"failure_reason":"build_error","import_side_effects":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.9-slim","python_version":"3.9","os_libc":"slim (glibc)","variant":"opentelemetry-instrumentation-writer","exit_code":1,"wheel_type":null,"failure_reason":"build_error","import_side_effects":null,"install_time_s":1.6,"import_time_s":null,"mem_mb":null,"disk_size":null}]}}