-
Notifications
You must be signed in to change notification settings - Fork 5
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
feat: enable Sentry in renderer process #397
Merged
Merged
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
40490f8
send sourcemap to sentry
cristianoventura 537250a
initialize sentry
cristianoventura dfaac67
Lint
cristianoventura bd84364
add sentry org and projec variables to release.yml
cristianoventura 93f2055
Merge branch 'main' of github.com:grafana/k6-studio into feat/crash-r…
cristianoventura 11996a9
Merge branch 'main' of github.com:grafana/k6-studio into feat/crash-r…
cristianoventura 72c81a3
crash report settings
cristianoventura 07c31d2
conditionally send event based on user preference
cristianoventura 43631c7
temporarily remove link from sentry opt-in
cristianoventura 989c43f
Remove learn more link
cristianoventura 88c205d
Bump schema version
cristianoventura a425d5d
Merge branch 'main' into feat/crash-reporter-settings
cristianoventura 879fa3c
Fix test
cristianoventura 494642a
Merge branch 'feat/crash-reporter-settings' of github.com:grafana/k6-…
cristianoventura 0f60ba8
Test v2 migration
cristianoventura ee8b656
Change copy for Telemetry settings
cristianoventura 32367fd
enable Sentry in renderer process
cristianoventura ab6bb99
Merge branch 'main' of github.com:grafana/k6-studio into feat/sentry-…
cristianoventura f25083a
capture unhandled promise rejections
cristianoventura 5c2908e
configure sentry for renderer and preload processes
cristianoventura 38ca017
disable integrations
cristianoventura 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 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 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 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,25 @@ | ||
import * as SentryRenderer from '@sentry/electron/renderer' | ||
import { AppSettings } from './types/settings' | ||
|
||
export function configureRendererProcess( | ||
getSettingsFn?: () => Promise<AppSettings> | ||
) { | ||
if (process.env.NODE_ENV !== 'development') { | ||
SentryRenderer.init({ | ||
// conditionally send the event based on the user's settings | ||
beforeSend: async (event) => { | ||
const getSettings = getSettingsFn || window.studio.settings.getSettings | ||
const { telemetry } = await getSettings() | ||
if (telemetry.errorReport) { | ||
return event | ||
} | ||
return null | ||
}, | ||
}) | ||
|
||
// attach event listener to catch unhandled promise rejections | ||
window.addEventListener('unhandledrejection', (event) => { | ||
SentryRenderer.captureException(event.reason) | ||
}) | ||
} | ||
} |
Oops, something went wrong.
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.
window
isn't available in the preload context so I'm adding flexibility here to pass the getSettings function as an argument optionally.