feat(log): add view command to display log entry details#212
Merged
Conversation
Adds 'sentry log view <log-id>' to display detailed information about a single log entry. Supports: - Auto-detect org/project from DSN or config - Explicit target: sentry log view <org>/<project> <log-id> - Project search: sentry log view <project> <log-id> - JSON output with --json flag - Open in browser with --web flag - Trace link when trace ID is present Output includes: - Core: ID, timestamp, severity, message - Context: project, environment, release - SDK: name, version - Trace: trace ID, span ID, clickable link - Source location: function, file, line (when available) - OpenTelemetry data (when available)
Semver Impact of This PR🟡 Minor (new features) 📋 Changelog PreviewThis is how your changes will appear in the changelog. New Features ✨
Bug Fixes 🐛Upgrade
Documentation 📚
🤖 This preview updates automatically when you update the PR. |
|
Codecov Results 📊❌ Patch coverage is 69.53%. Project has 2062 uncovered lines. Files with missing lines (41)
Coverage diff@@ Coverage Diff @@
## main #PR +/-##
==========================================
- Coverage 76.73% 76.46% -0.27%
==========================================
Files 65 66 +1
Lines 8419 8758 +339
Branches 0 0 —
==========================================
+ Hits 6460 6696 +236
- Misses 1959 2062 +103
- Partials 0 0 —Generated by Codecov Action |
Unit tests: - test/commands/log/view.test.ts: parsePositionalArgs, resolveFromProjectSearch E2E tests: - test/e2e/log.test.ts: auth, context resolution, JSON output, error handling Formatter tests: - test/lib/formatters/log.test.ts: formatLogDetails output sections Supporting changes: - Export resolveFromProjectSearch for testing - Add test/fixtures/log-detail.json fixture - Update test/mocks/routes.ts to handle single log queries
Property tests for: - buildLogsUrl and buildTraceUrl URL builders - parsePositionalArgs argument parsing - formatLogDetails output formatting Tests verify invariants like: - URL validity, determinism, expected patterns - Correct field assignment regardless of input - Conditional sections appear only when data present
130dae7 to
b9b9fa0
Compare
- Include org placeholder in multi-project error example message - Fix SDK formatting when only version exists (no name) - Use dynamic header length for separator width instead of hardcoded value
- Add projectSlug parameter to getLog() API function for proper filtering - Use project:slug filter in query to ensure logs match the resolved project - Change 'log not found' error from ContextError to ValidationError (the log ID was provided, it just doesn't exist - not a missing context issue) - Update mock server to parse project filter from query string
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Adds
sentry log view <log-id>command to display detailed information about a single Sentry log entry. Complements the existingsentry log listcommand.Features
sentry log view <org>/<project> <log-id>orsentry log view <project> <log-id>--jsonflag for machine-readable output--webflag opens the log in Sentry's Logs explorerOutput
Human-readable output includes:
Test Plan