Skip to content
DocsGitHub

attribute

Explore span, log, and metric attributes

sentry attribute list [<target>] [<filter>]

Section titled “sentry attribute list [<target>] [<filter>]”

List attribute keys for spans, logs, or metrics

Arguments:

Argument Description
[<target>] <org>/ (all projects), <org>/<project>, or <project> (search)
[<filter>] Text in attribute names and/or has:<key> terms, e.g. 'gen_ai has:http.method'

Options:

Option Description
-d, --dataset <dataset> Dataset to list attributes for (spans, logs, metrics) (default: "spans")
--type <type>... Only show attributes of these types: string, number, boolean, array. Repeat the flag for each type or pass a comma-separated list (e.g. --type string,number)
-t, --period <period> Time range: "7d", "2024-01-01..2024-02-01", ">=2024-01-01" (default: "7d")
-n, --limit <limit> Maximum number of attributes to list (default: "25")
-f, --fresh Bypass cache, re-detect projects, and fetch fresh data
-c, --cursor <cursor> Navigate pages: "next", "prev", "first" (or raw cursor string)

Examples:

Terminal window
# List span attribute keys for a project
sentry attribute list my-org/my-project
# List log attribute keys across the whole organization
sentry attribute list my-org/ --dataset logs
# String attributes whose names contain gen_ai (case-sensitive)
sentry attribute list my-org/ gen_ai --type string
# Discover candidates alongside an attribute
sentry attribute list my-org/ has:gen_ai.request.model
# Discover candidates alongside several keys (one quoted argument)
sentry attribute list my-org/ 'has:gen_ai.request.model has:gen_ai.usage.input_tokens'
# Text and has: filters together
sentry attribute list my-org/ 'gen_ai has:http.method'
# Discover candidates using the last 24 hours (includes built-in and virtual keys)
sentry attribute list my-org/ --period 24h
# Show more than the default 25
sentry attribute list my-org/my-project -n 100
# Show the next page of the previous listing (same flags)
sentry attribute list my-org/my-project -n 100 -c next
# Filter spans that have a discovered key
sentry span list my-org/my-project -q 'has:gen_ai.request.model'
# Find a custom numeric attribute by name
sentry attribute list my-org/my-project cart.total --type number
# Show a discovered typed key as a span column
sentry span list my-org/my-project --fields 'tags[cart.total,number]'
# Group a metric by a discovered attribute
sentry explore my-org/ --dataset metrics -m llm.token_usage -F gen_ai.request.model
# Select fields as JSON
sentry attribute list my-org/ --json --fields key,type,source

All commands support --json for machine-readable output and --fields to select specific JSON fields.

Attributes are the typed key-value data attached to spans, logs, and metric samples. Their keys can be passed to other commands like explore to filter, add columns, or group results.

Custom non-string attributes include their type in the key, e.g. tags[cart.total,number]. Search for the name (cart.total), then use the returned key in queries and fields. Quote these keys in the shell.

The endpoint returns discovery candidates, including built-in and virtual keys even when no matching item was observed. It does not provide an exhaustive inventory or proof that every candidate co-occurs with the has: keys.