TheDocumentation Index
Fetch the complete documentation index at: https://docs.honeyhive.ai/llms.txt
Use this file to discover all available pages before exploring further.
honeyhive-logger package is a lightweight API wrapper with start(), log(), and update() functions. The v1 honeyhive package adds OpenTelemetry tracing, automatic context propagation, decorators, instrumentors, and evaluation support.
Use this guide when moving Python code from honeyhive-logger to honeyhive>=1.0.0.
The logger package is useful when you need a dependency-free client. Migrate to the v1 SDK when you want automatic spans, nested trace trees, framework integrations, or
evaluate().Use a coding agent to migrate
Use a coding agent to migrate
API mapping
| Logger API | v1 SDK replacement | Notes |
|---|---|---|
| (no logger equivalent) | HoneyHiveTracer.init(...) | New in v1: call once at app startup before any logger replacement. |
start(...) | tracer.create_session(...) / tracer.acreate_session(...) / tracer.with_session(...) | Choose with_session() for scoped blocks, acreate_session() for async frameworks (FastAPI, async Flask). |
log(...) (creates a new event) | @trace or enrich_span_context(...) | Both create a new span/event. Prefer decorators for function-level tracing. |
log(...) then enrich the same event | tracer.enrich_span(...) inside the active span | enrich_span() attaches fields to the currently active span. It does not create a new span on its own. |
update(event_id=...) | tracer.enrich_span(event_id=...) | Updates a specific existing event by ID via the events API. |
update(event_id=session_id, ...) | tracer.enrich_session(session_id=...) | Updates a session. |
duration_ms | Captured by spans automatically | Use metrics only if you need custom duration fields. |
1. Replace the package
You no longer need to set
HH_PROJECT or pass project= to HoneyHiveTracer.init(). HoneyHive API keys are project-scoped — the API key alone determines which project traces are routed to. Drop HH_PROJECT and project= anywhere they are set in logger code; neither has any effect on the API or SDK behavior. Passing project= explicitly to HoneyHiveTracer.init(...) emits a DeprecationWarning because the kwarg will be removed in v2.0. The examples below use HoneyHiveTracer.init() with no kwargs.2. Migrate session creation
Logger code usually starts a session and passessession_id to every event. In v1, initialize a tracer once and use session helpers to scope work.
await tracer.acreate_session(...) — same arguments as create_session().
For single-operation scripts, with_session() keeps session setup close to the work:
3. Replace log() with @trace
Use @trace when the event maps to a Python function.
tracer.enrich_span(...) inside the function for extra metadata, metrics, feedback, config, or a custom output shape.
4. Replace log() with manual spans when decorators do not fit
Use enrich_span_context() for loops, conditional blocks, or code that is not cleanly wrapped by a function.
In
honeyhive>=1.0.0, enrich_span_context is not re-exported at honeyhive or honeyhive.tracer. Import it from honeyhive.tracer.processing.context. Always pass tracer_instance=tracer — otherwise the helper falls back to an unconfigured OpenTelemetry tracer and spans will not reach HoneyHive. enrich_span_context does not expose an event_type parameter; set it via the raw attributes={"honeyhive_event_type": "tool"} attribute when migrating a log(event_type=...) call.tracer.start_span() only when you need raw OpenTelemetry control:
5. Replace update() for events
When you need to update a known event ID, pass it to tracer.enrich_span().
Use
event_id when you want to update an existing event in HoneyHive. If you are updating the current active span, omit event_id.event_id:
6. Replace update() for sessions
Logger uses update(event_id=session_id, ...) for session updates. In v1, use session enrichment.
create_session() in the active request, you can omit session_id:
7. Add automatic provider instrumentation
After migrating logger calls, you can add automatic model or framework spans.instrument() before constructing your provider client (for example, openai.OpenAI()). See Integrations for provider-specific setup.
Complete before and after
Migration checklist
- Replace
honeyhive-loggerwithhoneyhive>=1.0.0 - Export
HH_API_KEYin the environment (API keys are project-scoped; remove anyHH_PROJECTorproject=left over from logger code) - Initialize one
HoneyHiveTracerat startup - Replace
start()withcreate_session(),acreate_session(), orwith_session() - Replace function-level
log()calls with@trace - Replace block-level
log()calls withenrich_span_context() - Replace event
update()calls withtracer.enrich_span(event_id=...) - Replace session
update()calls withtracer.enrich_session(...) - Call
tracer.flush()(or setdisable_batch=True) for scripts, notebooks, and serverless handlers - Add provider instrumentors where automatic tracing is useful
- Confirm traces show nested spans and session outputs in HoneyHive
Related
Custom Spans
Learn decorator and manual span patterns.
Tracer Initialization
Place tracer initialization correctly for your runtime.
Enriching Traces
Add metadata, metrics, feedback, and outputs.
OpenAI Integration
Add automatic model call tracing.

