Skip to main content
Use enrich_span() and enrich_session() to attach user context, feature tags, evaluator scores, and config snapshots to HoneyHive traces so you can filter, debug, and evaluate production runs. Auto-instrumentation captures what your agent did; enrichments capture why it matters.

What types of enrichments can you add?

HoneyHive organizes custom attributes into typed namespaces. Each has a dedicated guide.

User Properties

Attach user IDs, account tiers, and other user context for per-user filtering and analysis.

User Feedback

Capture thumbs-up/down ratings, comments, and implicit signals directly on traces.

Custom Metrics

Log evaluation scores, guardrail results, and other numeric measurements computed in your app.

Config

Log prompt versions, model parameters, and other configuration context on traces.

Online Experiments

Tag traces with experiment IDs and variant names to analyze A/B tests in HoneyHive.
You can also attach arbitrary key-value pairs as metadata (e.g. feature flags, request IDs, environment tags). Any key that doesn’t belong to a typed namespace lands in metadata by default. For the full list of namespaces and data types, see the Schema Reference.

How do you enrich traces in code?

There are three functions, each scoped to a different level of your trace. Start from custom spans if you need to wrap business logic before enriching it.
Set attributes once and apply them to all traces in the session. Ideal for tenant context, app version, or user tier.
You can enrich a specific session by ID, which is useful in distributed systems:

Should you use global or instance enrichment methods?

Use instance methods in production for an explicit tracer reference.

What invocation patterns does enrich_span support?

Both enrich_span() and enrich_session() accept data in several forms.
Organize data by type using named parameters:
Extra keyword arguments are added to metadata automatically:

What are common enrichment use cases?

Attach user identity and message metadata to every traced call.
Tag traces by feature to compare performance across different parts of your app.
Capture HTTP request context for correlating traces with API traffic.
Log scores and experiment variants alongside your traces.
Record custom timing and throughput alongside auto-captured latency.
Enrich spans with success/failure status and error details for debugging.

How do session and span enrichment work together?

This example combines session-level and span-level enrichment in a single application.

How do you view enriched data in the dashboard?

1

Open the Session view

Go to your project in the HoneyHive dashboard and select Traces.
2

Inspect a session

Click any session to expand it. Your enriched data appears in the Metadata and Attributes panels.
3

Filter and analyze

Use enriched fields to filter events, build custom charts, or set up alerts.

What are trace enrichment best practices?

Where is the SDK reference?

Python SDK

enrich_span() and enrich_session()