- Deployments
- Tenants
- Experiments
- Per-call attributes: Use the
weave.attributes()to add metadata to specific operations or code blocks - Global attributes: Use the
global_attributesfield to set attributes at initialization that apply to all traces and evaluations in your project
Per-call attributes
Theweave.attributes() context manager allows you to add metadata to specific traced operations. This allows you to tag particular function calls or evaluation runs with contextual information.
- Python
- TypeScript
weave.attributes() contexts. Inner contexts override outer contexts for the same keys:
- Python
- TypeScript
Global attributes
When you set global attributes during Weave initialization, they automatically apply to all traces and evaluations in your project. This is useful for propagating project-wide metadata like environment, deployment version, or team information.- Python
- TypeScript
Combine global and per-call attributes
You can use global attributes and per-call attributes together. Per-call attributes with the same key override global attributes:- Python
- TypeScript
Get attributes during execution
Return the current set of attributes logged to your call. This can help you debug your calls or context for conditional logic.- Python
- TypeScript
The following example sets the Weave decorator to log the This outputs:
process_data function, configures attributes to log, and then returns them on execution.weave.get_current_call() only works inside a @weave.op decorated function. Outside of an op, it returns None.