-
-
Notifications
You must be signed in to change notification settings - Fork 244
feat(logs): allow project slugs in logs list #2688
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
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
2ccf295
feat(logs): allow slugs in logs list
shellmayr 97daf68
adjust help text
shellmayr 734086c
project/project_id parameter
shellmayr 8166805
add Cow
shellmayr eaace2f
formatting
shellmayr 760a600
fix tests for beta message
shellmayr b721e32
add tests for is_numeric_id
shellmayr 7cf5e6d
handle the emptystring case
shellmayr 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
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
7 changes: 7 additions & 0 deletions
7
tests/integration/_cases/logs/logs-list-no-logs-found-project-id.trycmd
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,7 @@ | ||
| ``` | ||
| $ sentry-cli logs list --org wat-org --project 12345 | ||
| ? success | ||
| [BETA] The "logs" command is in beta. The command is subject to breaking changes, including removal, in any Sentry CLI release. | ||
| No logs found | ||
|
|
||
| ``` |
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
13 changes: 13 additions & 0 deletions
13
tests/integration/_cases/logs/logs-list-with-data-project-id.trycmd
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,13 @@ | ||
| ``` | ||
| $ sentry-cli logs list --project 12345 | ||
| ? success | ||
| [BETA] The "logs" command is in beta. The command is subject to breaking changes, including removal, in any Sentry CLI release. | ||
| +------------------+---------------------------+----------+--------------------------+----------------------+ | ||
| | Item ID | Timestamp | Severity | Message | Trace | | ||
| +------------------+---------------------------+----------+--------------------------+----------------------+ | ||
| | test-item-id-001 | 2025-01-15T10:30:00+00:00 | info | test_log_message_001 | test-trace-id-abc123 | | ||
| | test-item-id-002 | 2025-01-15T10:31:00+00:00 | error | test_error_message_002 | test-trace-id-def456 | | ||
| | test-item-id-003 | 2025-01-15T10:32:00+00:00 | warning | test_warning_message_003 | test-trace-id-ghi789 | | ||
| +------------------+---------------------------+----------+--------------------------+----------------------+ | ||
|
|
||
| ``` |
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
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.
Bug: Numeric ID Check Fails for Digit Slugs
The
is_numeric_project_idfunction incorrectly returnstruefor project slugs that consist entirely of digits, causing them to be passed as aproject_idparameter instead of being included in the query string. This can lead to failed API requests or incorrect results. Additionally, the function incorrectly returnstruefor empty strings, which results in an empty project argument being treated as a numeric ID, causing no project filter to be applied and logs from all organization projects to be returned.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.
this may be a valid concern, at least the part about an empty project. We should validate that users cannot provide an empty string for this argument
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.
Fixed 👍