Skip to main content
Tags are string labels you attach to traces for categorization, filtering, and organization. Use tags to slice trace data by environment, team, feature, experiment, or any other dimension.

Setting tags

Attach tags to a span by setting the agentmark.tags span attribute. The gateway accepts a JSON array string, a comma-separated string, or a native array. Set the attribute inside a span() callback using ctx.setAttribute(). The Dashboard aggregates the tag list onto the parent trace.

Tags on child spans

You can set tags on any span. The gateway aggregates tags across a trace’s spans into the trace-level tag list shown in the Dashboard.

Filtering by tags

Tags appear as a column in the trace list. Filter by navigating to Traces, clicking Filters, selecting Tags, and choosing an operator and value.

Tags vs metadata

If you would use it as a label or category, make it a tag. If you would use it as a lookup key, make it metadata.

Limits

  • Up to 20 tags per span (the gateway drops extra tags).
  • The gateway trims each tag, which must be 1–100 characters. It drops longer tags.
  • The gateway ignores empty strings.

Best practices

  • Use kebab-case: production, team-alpha, chat-v2 (not Production, team_alpha)
  • Define tags as constants to avoid typos
  • Keep the tag set small. Tags with hundreds of unique values belong in metadata
  • Recommended patterns: environment (production, staging), team (team-alpha), feature (chat-v2), experiment (exp-new-prompt), release (v2.1.0)

Metadata

Key-value pairs for context and debugging

Filtering and search

Combine tags with other filters

Have questions?

Reach out any time: