Skip to main content
By default, Openlayer captures inputs, outputs, latency, tokens, and other information from your system. Often you will want to attach custom metadata — such as business context, IDs, or debug information — so you can later filter, search, or correlate traces inside the platform. This guide shows you how to do it.
Want to record user or session IDs? See the Track users and sessions guide.

Trace-level metadata

Use update_current_trace() to attach metadata to the entire trace (i.e., the full request lifecycle).
These key-value pairs appear in the trace metadata and can be filtered in the Openlayer UI.

Step-level metadata

Use update_current_step() to attach metadata to individual steps inside a trace. This is useful for logging retrieval parameters, generation settings, or intermediate results.