Tracing
Metadata and labels
How to add metadata to traces
Adding metadata to traces
It is often useful to add additional information to traces. For example, you may want to add the user ID or the environment name (staging, production, etc.) to the trace.
You can do this by adding metadata
to the trace.
Filtering traces by metadata
You can filter traces by metadata in the Laminar UI. Go to the traces page and select the spans tab.
Add a filter by metadata, and enter the name and value in the format metadata_key=metadata_value
.
Metadata vs labels
Adding metadata to a trace is different from adding a label. To learn more about adding labels programmatically, see labels.
Here’s a brief comparison of the two:
Metadata | Labels | |
---|---|---|
Scope | Applies to entire trace | Applies to individual spans |
Purpose | General trace context (e.g., environment, user ID) | Specific span classification or tagging |
Configuration | Set directly in code | Requires pre-configured label classes in UI |
Validation | Any string key-value pairs allowed | Must match predefined label names and values |
UI Location | Shown in trace overview | Shown in individual span details |
Common Uses | Environment info, user context, request IDs | Quality scores, data categories |