honeyhive.tracer.integration.compatibility
Dynamic backward compatibility functions for the refactored tracer module.
This module provides global functions that maintain backward compatibility with the original API while using the new modular tracer architecture. All compatibility functions use dynamic discovery and fallback patterns.
enrich_session
enrich_session(
session_id: str,
metadata: Optional[Dict[str, Any]] = None,
tracer: Optional[Any] = None,
tracer_instance: Optional[Any] = None,
) -> None
LEGACY (v1.0+): Dynamically enrich session with metadata.
.. deprecated:: 1.0
This free function pattern is provided for backward compatibility only.
Use instance methods instead: tracer.enrich_session()
This pattern will be removed in v2.0.
Recommended Pattern (v1.0+): Use the tracer instance method for explicit tracer reference::
tracer = HoneyHiveTracer.init(api_key="...", project="...")
tracer.enrich_session(
metadata={"user_id": "user-456"},
user_properties={"plan": "premium"}
)
This function provides backward compatibility for the global enrich_session function using dynamic tracer discovery and flexible metadata handling.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
session_id
|
str
|
The session ID to enrich |
required |
metadata
|
Optional[Dict[str, Any]]
|
Metadata dictionary to add to the session |
None
|
tracer
|
Optional[Any]
|
Optional tracer instance to use |
None
|
tracer_instance
|
Optional[Any]
|
Optional tracer instance for logging context |
None
|
Legacy Example
Using default tracer (backward compatibility)
enrich_session("session-123", {"user_id": "user-456"})
Using specific tracer (backward compatibility)
enrich_session("session-123", {"user_id": "user-456"}, tracer=my_tracer)
See Also
- :meth:
HoneyHiveTracer.enrich_session- Primary pattern (v1.0+) - :meth:
HoneyHiveTracer.enrich_span- Span enrichment
Source code in src/honeyhive/tracer/integration/compatibility.py
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 | |
get_compatibility_info
Get dynamic compatibility information.
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dictionary with compatibility status and available features |
Source code in src/honeyhive/tracer/integration/compatibility.py
343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 | |