Skip to main content

Overview

HoneyHive supports multiple tracer instances in a single application. Each instance maintains its own session context, configuration, and OTel TracerProvider. Instances do not share context. An ingestion key belongs to one project, so the key a tracer holds selects its project. Use a separate ingestion key when a tracer should write to a different HoneyHive project. Use metadata or session enrichment when traces should stay in the same project.

Use Cases

Environment-Based Tracing

Send each environment to the project its ingestion key belongs to:

Multi-Tenant SaaS

Give each tenant its own tracer and session metadata. If tenants need project-level isolation, select that tenant’s ingestion key:

A/B Testing

Run different configurations side-by-side and compare them with session metadata:

Feature Isolation

Route different features to separate projects, each with its own ingestion key:

Per-Request Initialization

For full isolation, initialize a tracer per request:

Thread Safety

HoneyHive uses Python’s contextvars for thread safety. When using thread pools, propagate context explicitly:
Copy the context for each executor.submit() call. Reusing a single context object across threads causes race conditions. See Multi-Threading for details.

Best Practices

  • Keep tracer instances in a central registry - create once, reuse many times
  • Use a separate ingestion key when a tracer should write to a different project
  • Store API keys in environment variables or a secret manager, never hard-code them
  • Use metadata to differentiate when possible, rather than creating additional tracers
  • 2-5 tracers per application is typical and performant

Performance


Production Deployment

Initialization patterns for production environments

Multi-Threaded Tracing

Context propagation across threads