chore: add Sentry crash reporting alongside PostHog analytics - #5
Merged
Conversation
Introduce opt-in Sentry error reporting for unexpected crashes, sharing the existing anonymous id with PostHog. Telemetry credentials (Sentry DSN, PostHog key/host) move out of source and are injected at build time via `bun build --define` (buildInfo.ts), falling back to empty strings that disable each integration for local/dev builds. Sentry.init runs before the logger so its pinoIntegration subscribes to pino's diagnostics channel first, and is hardened for privacy: breadcrumbs are dropped and server_name/request are stripped so org/repo names and the machine hostname never leave the box. The release workflow validates the credentials are present before building.
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 opt-in Sentry crash reporting for unexpected errors, complementing the existing PostHog product analytics. Telemetry credentials (Sentry DSN, PostHog key/host) move out of source into
buildInfo.tsand are injected at build time viabun build --define, falling back to empty strings that disable each integration — so binaries built from source send nothing. Both share the existing anonymous id, and the README's privacy guarantee is preserved: org/repo names, tokens, report contents, and the machine hostname never leave the user's machine. Also adds a pull request template (separate commit).Review focus
Telemetry.ts—beforeBreadcrumbdrops every breadcrumb andbeforeSenddeletesserver_name/request. The question worth scrutiny: is this sufficient against Sentry's defaults to truly guarantee no org/repo name or hostname can leak via an error event?index.ts—Sentry.initmust run beforecreateLoggersopinoIntegrationsubscribes to pino's diagnostics channel first. Telemetry is gated toNoopTelemetry/NoopAnalyticswhenever creds are empty (local/dev build) or the user opted out.Commits
fe6c32a— chore: add Sentry crash reporting alongside PostHog analytics416312d— chore: add pull request template