Start to clean up Sentry now that the app is back up again. (#356)
* Start to clean up Sentry now that the app is back up again. Remove Sentry from local development I thought .env.development was for dev.kc.io, not just local dev. Someone can add this to .local if they need to test the Sentry stuff for now. Signed-off-by: Paul Tagliamonte <paul@kittycad.io>
This commit is contained in:
@ -2,5 +2,5 @@ VITE_KC_API_WS_MODELING_URL=wss://api.dev.kittycad.io/ws/modeling/commands
|
|||||||
VITE_KC_API_BASE_URL=https://api.dev.kittycad.io
|
VITE_KC_API_BASE_URL=https://api.dev.kittycad.io
|
||||||
VITE_KC_SITE_BASE_URL=https://dev.kittycad.io
|
VITE_KC_SITE_BASE_URL=https://dev.kittycad.io
|
||||||
VITE_KC_CONNECTION_TIMEOUT_MS=5000
|
VITE_KC_CONNECTION_TIMEOUT_MS=5000
|
||||||
VITE_KC_CONNECTION_WEBRTC_REPORT_STATS_MS=30000
|
VITE_KC_CONNECTION_WEBRTC_REPORT_STATS_MS=0
|
||||||
VITE_KC_SENTRY_DSN=https://a814f2f66734989a90367f48feee28ca@o1042111.ingest.sentry.io/4505789425844224
|
VITE_KC_SENTRY_DSN=
|
||||||
|
@ -38,10 +38,10 @@ import {
|
|||||||
} from './machines/settingsMachine'
|
} from './machines/settingsMachine'
|
||||||
import { ContextFrom } from 'xstate'
|
import { ContextFrom } from 'xstate'
|
||||||
import CommandBarProvider from 'components/CommandBar'
|
import CommandBarProvider from 'components/CommandBar'
|
||||||
import { VITE_KC_SENTRY_DSN } from './env'
|
import { TEST, VITE_KC_SENTRY_DSN } from './env'
|
||||||
import * as Sentry from '@sentry/react'
|
import * as Sentry from '@sentry/react'
|
||||||
|
|
||||||
if (VITE_KC_SENTRY_DSN) {
|
if (VITE_KC_SENTRY_DSN && !TEST) {
|
||||||
Sentry.init({
|
Sentry.init({
|
||||||
dsn: VITE_KC_SENTRY_DSN,
|
dsn: VITE_KC_SENTRY_DSN,
|
||||||
// TODO(paultag): pass in the right env here.
|
// TODO(paultag): pass in the right env here.
|
||||||
|
@ -112,6 +112,11 @@ export class EngineConnection {
|
|||||||
isReady() {
|
isReady() {
|
||||||
return this.ready
|
return this.ready
|
||||||
}
|
}
|
||||||
|
// shouldTrace will return true when Sentry should be used to instrument
|
||||||
|
// the Engine.
|
||||||
|
shouldTrace() {
|
||||||
|
return Sentry.getCurrentHub()?.getClient()?.getOptions()?.sendClientReports
|
||||||
|
}
|
||||||
// connect will attempt to connect to the Engine over a WebSocket, and
|
// connect will attempt to connect to the Engine over a WebSocket, and
|
||||||
// establish the WebRTC connections.
|
// establish the WebRTC connections.
|
||||||
//
|
//
|
||||||
@ -122,15 +127,20 @@ export class EngineConnection {
|
|||||||
// when a connection is in progress (state: connecting or something).
|
// when a connection is in progress (state: connecting or something).
|
||||||
|
|
||||||
// Information on the connect transaction
|
// Information on the connect transaction
|
||||||
const webrtcMediaTransaction = Sentry.startTransaction({
|
|
||||||
name: 'webrtc-media',
|
|
||||||
})
|
|
||||||
|
|
||||||
const websocketSpan = webrtcMediaTransaction.startChild({ op: 'websocket' })
|
let webrtcMediaTransaction: Sentry.Transaction
|
||||||
|
let websocketSpan: Sentry.Span
|
||||||
let mediaTrackSpan: Sentry.Span
|
let mediaTrackSpan: Sentry.Span
|
||||||
let dataChannelSpan: Sentry.Span
|
let dataChannelSpan: Sentry.Span
|
||||||
let handshakeSpan: Sentry.Span
|
let handshakeSpan: Sentry.Span
|
||||||
|
|
||||||
|
if (this.shouldTrace()) {
|
||||||
|
webrtcMediaTransaction = Sentry.startTransaction({
|
||||||
|
name: 'webrtc-media',
|
||||||
|
})
|
||||||
|
websocketSpan = webrtcMediaTransaction.startChild({ op: 'websocket' })
|
||||||
|
}
|
||||||
|
|
||||||
this.websocket = new WebSocket(this.url, [])
|
this.websocket = new WebSocket(this.url, [])
|
||||||
this.websocket.binaryType = 'arraybuffer'
|
this.websocket.binaryType = 'arraybuffer'
|
||||||
|
|
||||||
@ -144,6 +154,7 @@ export class EngineConnection {
|
|||||||
})
|
})
|
||||||
|
|
||||||
this.websocket.addEventListener('open', (event) => {
|
this.websocket.addEventListener('open', (event) => {
|
||||||
|
if (this.shouldTrace()) {
|
||||||
// websocketSpan.setStatus(SpanStatus.OK)
|
// websocketSpan.setStatus(SpanStatus.OK)
|
||||||
websocketSpan.finish()
|
websocketSpan.finish()
|
||||||
|
|
||||||
@ -151,7 +162,10 @@ export class EngineConnection {
|
|||||||
dataChannelSpan = webrtcMediaTransaction.startChild({
|
dataChannelSpan = webrtcMediaTransaction.startChild({
|
||||||
op: 'data-channel',
|
op: 'data-channel',
|
||||||
})
|
})
|
||||||
mediaTrackSpan = webrtcMediaTransaction.startChild({ op: 'media-track' })
|
mediaTrackSpan = webrtcMediaTransaction.startChild({
|
||||||
|
op: 'media-track',
|
||||||
|
})
|
||||||
|
}
|
||||||
this.onWebsocketOpen(this)
|
this.onWebsocketOpen(this)
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -215,11 +229,13 @@ export class EngineConnection {
|
|||||||
})
|
})
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if (this.shouldTrace()) {
|
||||||
// When both ends have a local and remote SDP, we've been able to
|
// When both ends have a local and remote SDP, we've been able to
|
||||||
// set up successfully. We'll still need to find the right ICE
|
// set up successfully. We'll still need to find the right ICE
|
||||||
// servers, but this is hand-shook.
|
// servers, but this is hand-shook.
|
||||||
handshakeSpan.finish()
|
handshakeSpan.finish()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else if (resp.type === 'trickle_ice') {
|
} else if (resp.type === 'trickle_ice') {
|
||||||
let candidate = resp.data?.candidate
|
let candidate = resp.data?.candidate
|
||||||
this.pc?.addIceCandidate(candidate as RTCIceCandidateInit)
|
this.pc?.addIceCandidate(candidate as RTCIceCandidateInit)
|
||||||
@ -303,10 +319,12 @@ export class EngineConnection {
|
|||||||
console.log('received track', event)
|
console.log('received track', event)
|
||||||
const mediaStream = event.streams[0]
|
const mediaStream = event.streams[0]
|
||||||
|
|
||||||
|
if (this.shouldTrace()) {
|
||||||
mediaStream.getVideoTracks()[0].addEventListener('unmute', () => {
|
mediaStream.getVideoTracks()[0].addEventListener('unmute', () => {
|
||||||
mediaTrackSpan.finish()
|
mediaTrackSpan.finish()
|
||||||
webrtcMediaTransaction.finish()
|
webrtcMediaTransaction.finish()
|
||||||
})
|
})
|
||||||
|
}
|
||||||
|
|
||||||
// Set up the background thread to keep an eye on statistical
|
// Set up the background thread to keep an eye on statistical
|
||||||
// information about the WebRTC media stream from the server to
|
// information about the WebRTC media stream from the server to
|
||||||
@ -317,6 +335,9 @@ export class EngineConnection {
|
|||||||
if (this.pc === undefined) {
|
if (this.pc === undefined) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
if (!this.shouldTrace()) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
console.log('Reporting statistics')
|
console.log('Reporting statistics')
|
||||||
|
|
||||||
@ -424,7 +445,7 @@ export class EngineConnection {
|
|||||||
// )
|
// )
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
transaction.finish()
|
transaction?.finish()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}, VITE_KC_CONNECTION_WEBRTC_REPORT_STATS_MS)
|
}, VITE_KC_CONNECTION_WEBRTC_REPORT_STATS_MS)
|
||||||
@ -446,7 +467,9 @@ export class EngineConnection {
|
|||||||
console.log('accepted lossy data channel', event.channel.label)
|
console.log('accepted lossy data channel', event.channel.label)
|
||||||
this.lossyDataChannel.addEventListener('open', (event) => {
|
this.lossyDataChannel.addEventListener('open', (event) => {
|
||||||
console.log('lossy data channel opened', event)
|
console.log('lossy data channel opened', event)
|
||||||
|
if (this.shouldTrace()) {
|
||||||
dataChannelSpan.finish()
|
dataChannelSpan.finish()
|
||||||
|
}
|
||||||
|
|
||||||
this.onDataChannelOpen(this)
|
this.onDataChannelOpen(this)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user