How to enrich your traces and spans with additional context
@trace
Python decorator or traceFunction
JavaScript method. Here’s the guide for custom spans to set those up.
session
, you can use
To log additional context to a specific child event
span, you can use
These are useful if you want to add context within a traced function during runtime.
Attribute Key | Type | Description | enrich_session | enrich_span |
---|---|---|---|---|
config | Object | Configuration details | ✓ | ✓ |
feedback | Object | User feedback or annotations | ✓ | ✓ |
metrics | Object | Metrics, scores, or evaluations | ✓ | ✓ |
metadata | Object | Catch-all for arbitrary metadata or JSON | ✓ | ✓ |
outputs | Object | Output data from the function or event | ✓ | ✓ |
user_properties | Object | User-specific attributes | ✓ | ✗ |
event_type | String | Type of event (chain, model, tool) | ✗ | ✓ |
inputs | Object | Input data for the function or event | ✗ | ✓ |
error | String | Error information if applicable | ✗ | ✓ |