@@ -11,12 +11,14 @@ import {
1111 initializeSentry ,
1212 logError ,
1313} from '@codesandbox/common/lib/utils/analytics' ;
14+ import { logBreadcrumb } from '@codesandbox/common/lib/utils/analytics/sentry' ;
1415import _debug from '@codesandbox/common/lib/utils/debug' ;
1516import {
1617 convertTypeToStatus ,
1718 notificationState ,
1819} from '@codesandbox/common/lib/utils/notifications' ;
1920import { isSafari } from '@codesandbox/common/lib/utils/platform' ;
21+ import { Severity } from '@sentry/browser' ;
2022import { client } from 'app/graphql/client' ;
2123import history from 'app/utils/history' ;
2224import { createOvermind } from 'overmind' ;
@@ -43,16 +45,6 @@ window.addEventListener('unhandledrejection', e => {
4345 }
4446} ) ;
4547
46- if ( process . env . NODE_ENV === 'production' ) {
47- try {
48- initializeSentry (
49- 'https://[email protected] /155188' 50- ) ;
51- } catch ( error ) {
52- console . error ( error ) ;
53- }
54- }
55-
5648window . __isTouch = ! matchMedia ( '(pointer:fine)' ) . matches ;
5749
5850const overmind = createOvermind ( config , {
@@ -66,6 +58,48 @@ const overmind = createOvermind(config, {
6658 logProxies : true ,
6759} ) ;
6860
61+ if ( process . env . NODE_ENV === 'production' ) {
62+ const ignoredOvermindActions = [
63+ 'onInitialize' ,
64+ 'server.onCodeSandboxAPIMessage' ,
65+ 'track' ,
66+ 'editor.previewActionReceived' ,
67+ 'live.onSelectionChanged' ,
68+ ] ;
69+
70+ try {
71+ initializeSentry (
72+ 'https://[email protected] /155188' 73+ ) ;
74+
75+ overmind . eventHub . on ( 'action:start' , event => {
76+ if ( ignoredOvermindActions . includes ( event . actionName ) ) {
77+ return ;
78+ }
79+
80+ // We try as the payload might cause a stringify error
81+ try {
82+ logBreadcrumb ( {
83+ category : 'overmind-action' ,
84+ message : event . actionName ,
85+ level : Severity . Info ,
86+ data : {
87+ value : JSON . stringify ( event . value ) ,
88+ } ,
89+ } ) ;
90+ } catch ( e ) {
91+ logBreadcrumb ( {
92+ category : 'overmind-action' ,
93+ message : event . actionName ,
94+ level : Severity . Info ,
95+ } ) ;
96+ }
97+ } ) ;
98+ } catch ( error ) {
99+ console . error ( error ) ;
100+ }
101+ }
102+
69103/*
70104 Temporary global functions to grab state and actions, related to old
71105 Cerebral implementation
0 commit comments