--- id: opentelemetry-instrumentation-transformers version: "0.62.3" license: Apache-2.0 license_treatment: permissive maintenance: active --- # opentelemetry-instrumentation-transformers — OpenTelemetry transformers instrumentation License: permissive · Maintenance: active · Downloads: 6.8M/mo ## 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 above — 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 pip install opentelemetry-instrumentation-transformers uv add opentelemetry-instrumentation-transformers 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_current - Install friction: low - Maintenance: active - Downloads: 6.8M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags opentelemetry transformers tracing, huggingface instrumentation observability, llm call tracing, transformers span collection, ai model monitoring, text generation tracing, huggingface debugging, observability, llm-tracing, huggingface [View on SkillFed](https://skillfed.io/packages/opentelemetry-instrumentation-transformers) · [View on PyPI](https://pypi.org/project/opentelemetry-instrumentation-transformers/)