Repository navigation
feat(cli): add attribute list command #1559
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
lzhao-sentry
wants to merge
2
commits into
main
Choose a base branch
from
lzhao/feat/add-attribute-list-command
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 | ||
| 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 | ||
| ``` | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
packages/cli/plugins/sentry-cli/skills/sentry-cli/references/attribute.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| 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. | ||||||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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: {}, | ||
| }, | ||
| }); |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.