Overview
Attributes and tags are two ways to add metadata to traces:- Attributes: Key-value pairs for detailed, queryable data
- Tags: Simple labels for categorization and filtering
Attributes
Adding Single Attributes
Adding Multiple Attributes
Complex Values
Objects are automatically stringified to JSON:Common Attribute Patterns
Tags
Adding Single Tags
Adding Multiple Tags
Tag Use Cases
Tags are ideal for:- Chain identification:
ethereum,polygon,arbitrum - Operation type:
swap,transfer,mint,stake - Environment:
production,staging,development - Feature flags:
beta,experimental - Priority:
critical,high,normal
Attributes vs Tags
| Aspect | Attributes | Tags |
|---|---|---|
| Structure | Key-value pairs | Simple strings |
| Use case | Detailed data | Categorization |
| Queryability | Filter by key and value | Filter by presence |
| Example | userId: "123" | "ethereum" |
When to Use Attributes
- Specific values you’ll query: user IDs, amounts, addresses
- Data that varies per trace: transaction hashes, block numbers
- Structured information: configuration objects
When to Use Tags
- Categories that group traces: chain names, operation types
- Boolean-like flags: is this production? is this a swap?
- Simple labels for filtering dashboards