- Environment — production, staging, development
- Region — us-west, eu-central
- Deployment — version numbers, feature flags, A/B test variants
- Request context — correlation IDs, upstream service info
Adding Metadata
Set metadata inside an active span context (for example, insideobserve() or an @observed function). If you call it outside any span context, it won’t attach to anything.
- TypeScript
- Python
Laminar.setTraceMetadata and observe(..., { metadata })Notes
- Setting trace metadata again overwrites the previous metadata—set all keys in one call.
- Keep metadata JSON-serializable and avoid sensitive data.
Filtering by Metadata
In the Laminar UI, metadata filters currently match exact key-value pairs (for example,region=us-west).
Metadata vs Tags
| Metadata | Tags | |
|---|---|---|
| Scope | Entire trace | Individual spans |
| Format | Key-value pairs | String labels |
| Best for | Environment, cohort, request context | Categorization, review labels |
Best Practices
- Use consistent keys (
environment,region,feature_flag). - Keep it lightweight and JSON-serializable.
- Avoid sensitive data (no PII).
