Add Sentry structured logging and custom metrics#5
Open
alea-a wants to merge 2 commits intocodyde:mainfrom
Open
Add Sentry structured logging and custom metrics#5alea-a wants to merge 2 commits intocodyde:mainfrom
alea-a wants to merge 2 commits intocodyde:mainfrom
Conversation
- Created sentry-utils.ts with helper functions for logging, metrics, and breadcrumbs - Instrumented WindowManager with lifecycle event logging (open, close, minimize, maximize, etc.) - Added comprehensive Chat component instrumentation with session tracking, message logging, and tool execution metrics - Enhanced Chat API route with request tracking, streaming metrics, and error context - Added Desktop component logging for icon clicks and app launches - Enhanced SentryTest component with structured logging, breadcrumbs, and metrics - Updated sentry-test API route with enhanced error context and logging Features implemented: - Structured logging using Sentry.logger (debug, info, warning, error levels) - Custom metrics using Sentry.metrics (counters, distributions, gauges) - Breadcrumbs for user journey tracking - Enhanced error context with tags and custom data - Performance measurement with Timer utility class Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
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
This PR enhances the SentryOS application with comprehensive observability by adding Sentry structured logging and custom metrics throughout the codebase.
Changes
New Files
src/lib/sentry-utils.ts- Centralized utility module with helper functions for logging, metrics, breadcrumbs, and a Timer class for performance measurementsEnhanced Files
Features Implemented
📝 Structured Logging
Sentry.loggerwith appropriate log levels (debug, info, warning, error)📊 Custom Metrics
🍞 Breadcrumbs
🎯 Enhanced Error Context
Metrics Tracked
Window Management:
window.open,window.close,window.minimize,window.maximize,window.restore,window.focuswindow.count(gauge)Chat Interactions:
chat.message.sent,chat.response.received,chat.tool.executionchat.api.duration,chat.stream.duration(distributions)chat.active_sessions(gauge)Desktop:
desktop.icon.click,desktop.app.launchTesting
All changes have been implemented following best practices:
Verification
To verify the changes:
🤖 Generated with Claude Code