Skip to main content
You have traces in HoneyHive, but they’re missing context about which user made each request or what feature was being used. Let’s fix that. What you’ll learn:
  • Add session-level context (environment, app version)
  • Add metadata directly to LLM spans
  • Add metadata to parent spans for complex pipelines
Time: 5 minutes

Setup with Session Context

First, initialize the tracer and set session-level context that applies to ALL traces:
Session metadata showing tenant_id, user_tier, app_version

Session metadata appears on all traces


Option 1: Enrich LLM Spans Directly

The simplest way to add per-call metadata - use using_attributes from OpenInference:
The metadata is attached directly to the ChatCompletion span:
ChatCompletion span with session_id, user_id, metadata

Metadata attached directly to the LLM span


Option 2: Create a Parent Span

When you have multiple steps (retrieval, processing, LLM calls), use @trace to create a parent span that groups them:
The parent span groups all steps together, so you can see the full pipeline duration and trace through each step:
Parent span showing question, user_id inputs and answer output

Parent span captures business inputs/outputs, LLM call nested inside


When to Use Which


Best Practices

DO: Add user IDs, feature names, environment. Use descriptive keys (user_id not uid). DON’T: Include passwords, API keys, or PII. Keep fields under 1KB.

What’s Next?

Run Your First Experiment

Set up datasets and run evaluations

Enrichment Reference

Detailed guide for advanced enrichment patterns