Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions apps/cli-docs/src/content/docs/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ toolkit/
│ │ ├── commands/ # CLI commands
│ │ │ ├── agent-conversation/# list, view
│ │ │ ├── alert/ # create, delete, edit, list, view
│ │ │ ├── attribute/ # list
│ │ │ ├── auth/ # list, login, logout, refresh, status, switch, token, whoami
│ │ │ ├── build/ # download, upload
│ │ │ ├── cli/ # completion, defaults, feedback, fix, import, setup, uninstall, upgrade
Expand Down
28 changes: 28 additions & 0 deletions apps/cli-docs/src/fragments/commands/attribute.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@


## Examples

### List attributes

```bash
# 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

# Find keys containing "http" that are also of type string
sentry attribute list --search http --type string

# Attributes seen on the same spans as the specified attribute
sentry attribute list --with gen_ai.request.model

# Add descriptions, example values, and deprecation info

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# Add descriptions, example values, and deprecation info
# Show descriptions, example values, and deprecation info

sentry attribute list --search http --context

# Show more than the default 25
sentry attribute list my-org/my-project -n 100

# Select fields as JSON
sentry attribute list --json --fields key,type,source
```
8 changes: 8 additions & 0 deletions packages/cli/plugins/sentry-cli/skills/sentry-cli/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,14 @@ Manage Sentry alert rules

→ Full flags and examples: `references/alert.md`

### Attribute

Explore span, log, and metric attributes

- `sentry attribute list [<org/project>]` — List attribute keys for spans, logs, or metrics

→ Full flags and examples: `references/attribute.md`

### Build

Manage mobile build artifacts
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
---
name: sentry-cli-attribute
version: 0.48.0-dev.0
description: Explore span, log, and metric attributes
requires:
bins: ["sentry"]
auth: true
---

# Attribute Commands

Explore span, log, and metric attributes

### `sentry attribute list [<org/project>]`

List attribute keys for spans, logs, or metrics

**Flags:**
- `-d, --dataset <value> - Dataset to list attributes for (spans, logs, metrics) - (default: "spans")`
- `--type <value>... - Find attributes of these types (string, number, boolean, array; repeatable, comma-separated)`
- `-s, --search <value> - Find attribute keys containing this text (case-sensitive)`
- `--with <value>... - Find attributes that appear on the same items as all of these keys (repeatable, comma-separated)`
- `-t, --period <value> - Time range: "7d", "2024-01-01..2024-02-01", ">=2024-01-01" - (default: "14d")`
- `-n, --limit <value> - Maximum number of attributes to list - (default: "25")`
- `--context - Include each attribute's description, examples, and deprecation info (experimental API)`
- `-f, --fresh - Bypass cache, re-detect projects, and fetch fresh data`

**Examples:**

```bash
# 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

# Find keys containing "http" that are also of type string
sentry attribute list --search http --type string

# Attributes seen on the same spans as the specified attribute
sentry attribute list --with gen_ai.request.model

# Add descriptions, example values, and deprecation info

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# Add descriptions, example values, and deprecation info
# Show descriptions, example values, and deprecation info

sentry attribute list --search http --context

# Show more than the default 25
sentry attribute list my-org/my-project -n 100

# Select fields as JSON
sentry attribute list --json --fields key,type,source
```

All commands also support `--json`, `--fields`, `--help`, `--log-level`, and `--verbose` flags.
6 changes: 6 additions & 0 deletions packages/cli/src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import { conversationRoute } from "./commands/agent-conversation/index.js";
import { listCommand as conversationListCommand } from "./commands/agent-conversation/list.js";
import { alertRoute } from "./commands/alert/index.js";
import { apiCommand } from "./commands/api.js";
import { attributeRoute } from "./commands/attribute/index.js";
import { listCommand as attributeListCommand } from "./commands/attribute/list.js";
import { authRoute } from "./commands/auth/index.js";
import { whoamiCommand } from "./commands/auth/whoami.js";
import { bashHookCommand } from "./commands/bash-hook.js";
Expand Down Expand Up @@ -96,6 +98,7 @@ import { buildRouteMap } from "./lib/route-map.js";
*/
const PLURAL_TO_SINGULAR: Record<string, string> = {
"agent-conversations": "agent-conversation",
attributes: "attribute",
dashboards: "dashboard",
dsns: "dsn",
events: "event",
Expand All @@ -121,6 +124,7 @@ export const routes = buildRouteMap({
routes: {
help: helpCommand,
alert: alertRoute,
attribute: attributeRoute,
auth: authRoute,
build: buildRoute,
cli: cliRoute,
Expand Down Expand Up @@ -167,6 +171,7 @@ export const routes = buildRouteMap({
"send-envelope": sendEnvelopeCommand,
"bash-hook": bashHookCommand,
"agent-conversations": conversationListCommand,
attributes: attributeListCommand,
dashboards: dashboardListCommand,
dsns: dsnListCommand,
integrations: integrationListCommand,
Expand Down Expand Up @@ -194,6 +199,7 @@ export const routes = buildRouteMap({
hideRoute: {
dsns: true,
"agent-conversations": true,
attributes: true,
dashboards: true,
events: true,
integrations: true,
Expand Down
17 changes: 17 additions & 0 deletions packages/cli/src/commands/attribute/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/** Trace item attribute commands. */

import { buildRouteMap } from "../../lib/route-map.js";
import { listCommand } from "./list.js";

export const attributeRoute = buildRouteMap({
routes: { list: listCommand },
docs: {
brief: "Explore span, log, and metric attributes",
fullDescription:
"List the attribute keys available on spans, logs, and trace metrics.\n\n" +
"Commands:\n" +
" list List attribute keys with their type and source\n\n" +
"Alias: `sentry attributes` → `sentry attribute list`",
hideRoute: {},
},
});
Loading
Loading