Skip to content

Better error logging in posthog #6346

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 5 commits into from
Feb 6, 2025
Merged

Better error logging in posthog #6346

merged 5 commits into from
Feb 6, 2025

Conversation

neubig
Copy link
Contributor

@neubig neubig commented Jan 18, 2025

End-user friendly description of the problem this fixes or functionality that this introduces

  • Include this change in the Release Notes. If checked, you must provide an end-user friendly description for your change below

Add comprehensive error logging to PostHog


Give a summary of what the PR does, explaining any non-trivial design decisions

This commit adds centralized error logging to PostHog for all errors displayed in the frontend, whether through toasts or in the chat window. Changes include:

  • New error-handler.ts utility for centralized error handling and logging
  • Comprehensive test coverage for error logging functionality
  • Integration with existing error display mechanisms
  • Consistent metadata handling for better error tracking

Link of any specific issues this addresses

Resolves #6344


To run this PR locally, use the following command:

docker run -it --rm   -p 3000:3000   -v /var/run/docker.sock:/var/run/docker.sock   --add-host host.docker.internal:host-gateway   -e SANDBOX_RUNTIME_CONTAINER_IMAGE=docker.all-hands.dev/all-hands-ai/runtime:df03e35-nikolaik   --name openhands-app-df03e35   docker.all-hands.dev/all-hands-ai/openhands:df03e35

This commit adds centralized error logging to PostHog for all errors displayed in the frontend, whether through toasts or in the chat window. Changes include:

- New error-handler.ts utility for centralized error handling and logging
- Comprehensive test coverage for error logging functionality
- Integration with existing error display mechanisms
- Consistent metadata handling for better error tracking

Resolves #6344
This commit adds centralized error logging to PostHog for all errors displayed in the frontend, whether through toasts or in the chat window. Changes include:

- New error-handler.ts utility for centralized error handling and logging
- Comprehensive test coverage for error logging functionality
- Integration with existing error display mechanisms
- Consistent metadata handling for better error tracking

Resolves #6344
@neubig neubig changed the title Feature/error logging 6344 Better error logging in posthog Jan 18, 2025
@neubig neubig marked this pull request as draft January 18, 2025 19:17
@neubig neubig self-assigned this Jan 18, 2025
@raymyers
Copy link
Contributor

raymyers commented Feb 6, 2025

Since I cannot push to this branch, I've PR'd to it in #6641 with some small changes.

}: ErrorDetails) {
logError({ message, source, metadata });
toast.custom((t: { id: string }) =>
_jsx(ErrorToast, { id: t.id, error: message }),
Copy link
Contributor

Choose a reason for hiding this comment

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

When I tried this the styling didn't work, so my PR suggestion reverts this to the current behavior, toast.error(...), and we can change the display later.

Copy link
Contributor

@malhotra5 malhotra5 left a comment

Choose a reason for hiding this comment

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

LGTM! We may have more areas to track errors but this seems like a great start!

@malhotra5 malhotra5 enabled auto-merge (squash) February 6, 2025 19:56
@malhotra5 malhotra5 merged commit e930cd0 into main Feb 6, 2025
17 checks passed
@malhotra5 malhotra5 deleted the feature/error-logging-6344 branch February 6, 2025 20:16
adityasoni9998 pushed a commit to adityasoni9998/OpenHands that referenced this pull request Feb 7, 2025
adityasoni9998 pushed a commit to adityasoni9998/OpenHands that referenced this pull request Feb 7, 2025
chuckbutkus pushed a commit that referenced this pull request Feb 7, 2025
Co-authored-by: openhands <[email protected]>
Co-authored-by: Ray Myers <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add error monitoring in posthog logs
4 participants