Hugging Face (tracing)
Hugging Face (tracing)
Hugging Face provides open models, datasets, and the Transformers library. Respan’s Hugging Face instrumentation wraps the upstream Transformers OpenTelemetry instrumentor and normalizes TextGenerationPipeline.__call__ spans into Respan text-generation traces with model metadata, generation parameters, prompt and completion content, token counts, latency, and workflow context.
Set up Respan
Create an account at platform.respan.ai and grab an API key.
Run npx @respan/cli setup to set up with your coding agent.
Use Respan Gateway
See Hugging Face gateway setup for the separate OpenAI-compatible gateway route.
Example projects
Setup
Set environment variables
RESPAN_API_KEY exports traces to Respan. Hugging Face credentials are only needed when the Transformers model you load requires them.
View your trace
Open the Traces page to see the workflow span and its Hugging Face text-generation child span. The child span is stored as log_type=text and includes the model name, prompt, completion, generation parameters, estimated token usage, and latency.
Supported coverage
Configuration
Attributes
In Respan()
Set defaults at initialization. These apply to all generated spans.
With propagate_attributes
Override per-request using a context scope.
Disable captured content
Set TRACELOOP_TRACE_CONTENT=false before initializing Respan to keep prompt and completion text out of span content while still exporting model, generation parameter, workflow, and timing metadata.