skillfed

opentelemetry-instrumentation-transformers

OpenTelemetry transformers instrumentation

opentelemetry-instrumentation-transformers v0.62.3 6.8M downloads/30d#1,835 on PyPI7,377
Permissive license Apache-2.0 Active released

What it is and what it does

This package wraps HuggingFace Transformers library calls with OpenTelemetry instrumentation, automatically capturing text generation and embedding operations as distributed traces. Once initialized with a single call to `TransformersInstrumentor().instrument()`, it intercepts Transformers API calls and records them as spans containing prompts, completions, and embeddings—useful for debugging model behavior, tracking inference patterns, and correlating LLM calls with the rest of your application's trace data.

By default, all content (prompts and outputs) is logged to span attributes for full visibility. For privacy-sensitive applications or to reduce trace size, you can disable content logging via the `TRACELOOP_TRACE_CONTENT` environment variable. The package requires Python 3.10 or later and depends on opentelemetry-api, opentelemetry-instrumentation, opentelemetry-semantic-conventions-ai, and opentelemetry-semantic-conventions.

Use it for:

  • Debug LLM application behavior by inspecting prompts and completions in distributed traces
  • Monitor text generation performance and latency across your application infrastructure
  • Correlate Transformers calls with upstream requests and downstream database operations in end-to-end traces
  • Audit model inputs and outputs for compliance or quality evaluation in production systems
  • Reduce trace verbosity in privacy-critical deployments by disabling content logging

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Adds distributed tracing to HuggingFace Transformers library calls, capturing prompts, completions, and embeddings as OpenTelemetry spans for observability and debugging.

Yes, if you use HuggingFace Transformers and already have OpenTelemetry infrastructure in place. The package is actively maintained, has no known vulnerabilities, installs with low friction, and solves a real observability gap for LLM applications. Start with it if you need visibility into Transformers calls; skip it if you have no tracing backend or don't use Transformers.

Install

opentelemetry-instrumentation-transformers on PyPI

pip

pip install opentelemetry-instrumentation-transformers

uv

uv add opentelemetry-instrumentation-transformers

poetry

poetry add opentelemetry-instrumentation-transformers

Installing opentelemetry-instrumentation-transformers

Before you install

Low friction install with four runtime dependencies on OpenTelemetry core packages. Actively maintained with a release 4 days old and recent commits; part of a well-starred observability project.

License in practice

Apache-2.0 permissive license allows use in most commercial and open-source projects without significant restrictions.

Quickstart

pip install opentelemetry-instrumentation-transformers

from opentelemetry.instrumentation.transformers import TransformersInstrumentor

TransformersInstrumentor().instrument()

Requires Python 3.10 or later; requires an active OpenTelemetry tracing backend to export spans.

Verify before relying

  • Which specific Transformers library versions are compatible with this instrumentation
  • Whether instrumentation works with both local and remote model inference
  • Performance overhead of tracing on typical inference workloads

Package facts

License Apache-2.0 (permissive)
Python support supports the current Python release (<4,>=3.10)
Install friction low — pure-Python wheel
Runtime dependencies 4 — opentelemetry-api, opentelemetry-instrumentation, opentelemetry-semantic-conventions-ai, opentelemetry-semantic-conventions
Maintenance actively maintained — 4 days since the last release
Last repo commit
First released
Downloads 6,847,828/month — #1,835 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: opentelemetry_instrumentation_transformers-0.62.3-py3-none-any.whl

Tags

opentelemetry transformers tracinghuggingface instrumentation observabilityllm call tracingtransformers span collectionai model monitoringtext generation tracinghuggingface debugging
observabilityllm-tracinghuggingface

More Monitoring packages

tqdm

Wraps any iterable to display a real-time…

copyleft · top 100 on PyPI

opentelemetry-semantic-conventions

Provides generated Python code for…

permissive · top 100 on PyPI

opentelemetry-sdk

Provides the reference implementation of the…

permissive · top 100 on PyPI

opentelemetry-api

Provides the abstract API and interfaces for…

permissive · top 100 on PyPI

opentelemetry-exporter-otlp-proto-http

Exports OpenTelemetry observability data to an…

permissive · top 1,000 on PyPI

opentelemetry-instrumentation

Provides automatic instrumentation commands and…

permissive · top 1,000 on PyPI

opentelemetry-instrumentation-langchain

Adds distributed tracing to Langchain LLM…

permissive · top 5,000 on PyPI

openfeature-hooks-opentelemetry

Automatically captures feature flag evaluations…

permissive · top 15,000 on PyPI

opentelemetry-instrumentation-bedrock

Adds distributed tracing to AWS Bedrock API…

permissive · top 5,000 on PyPI

opentelemetry-instrumentation-watsonx

Automatically captures and traces IBM Watsonx…

permissive · top 5,000 on PyPI

opentelemetry-instrumentation-llamaindex

Adds distributed tracing to LlamaIndex…

permissive · top 5,000 on PyPI

opentelemetry-instrumentation-openai

Captures traces of OpenAI API calls (prompts,…

permissive · top 5,000 on PyPI

opentelemetry-instrumentation-haystack

Adds distributed tracing to Haystack LLM…

permissive · top 5,000 on PyPI

opentelemetry-instrumentation-replicate

Adds OpenTelemetry tracing to Replicate API…

permissive · top 5,000 on PyPI

opentelemetry-instrumentation-google-generativeai

Automatically traces prompts, completions, and…

permissive · top 5,000 on PyPI

opentelemetry-instrumentation-litellm

Adds OpenTelemetry tracing to LiteLLM,…

permissive · top 15,000 on PyPI