Skip to content

Commit 0f00064

Browse files
author
Mukul Tayal
committed
send terminal close events to sentry
1 parent 65860b6 commit 0f00064

File tree

5 files changed

+11
-2
lines changed

5 files changed

+11
-2
lines changed

.env

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,4 @@ GLOBAL_API_TIMEOUT=60000
4141
TRIGGER_API_TIMEOUT=60000
4242
LOGIN_DT_LOGO=
4343
SIDEBAR_DT_LOGO=
44+
LOG_TERMINAL_EVENTS_TO_SENTRY=false

src/components/ClusterNodes/ClusterTerminal.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ export default function ClusterTerminal({
343343
`user/terminal/get?namespace=${selectedNamespace.value}&shellName=${
344344
selectedTerminalType.value
345345
}&terminalAccessId=${terminalAccessIdRef.current}&containerName=${
346-
resourceData.containers?.[0].containerName || ''
346+
resourceData?.containers?.[0].containerName || ''
347347
}`,
348348
terminalAccessIdRef.current,
349349
window?._env_?.CLUSTER_TERMINAL_CONNECTION_RETRY_COUNT || 7,

src/components/terminal/TerminalWrapper.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ import ReactGA from 'react-ga4';
1212
import './terminal.scss';
1313
import { Scroller } from '../app/details/cicdHistory/History.components';
1414
import { SocketConnectionType } from '../app/details/appDetails/appDetails.type';
15+
import { logExceptionToSentry } from '@devtron-labs/devtron-fe-common-lib'
16+
1517

1618
interface TerminalViewProps {
1719
appDetails: AppDetails;
@@ -256,7 +258,8 @@ export class TerminalView extends Component<TerminalViewProps, TerminalViewState
256258
}
257259

258260
socket.onclose = function (evt) {
259-
setSocketConnection('DISCONNECTED');
261+
if (window._env_.LOG_TERMINAL_EVENTS_TO_SENTRY) logExceptionToSentry(evt)
262+
setSocketConnection('DISCONNECTED')
260263
}
261264

262265
socket.onerror = function (evt) {

src/components/v2/appDetails/k8Resource/nodeDetail/NodeDetailTabs/terminal/Terminal.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ import { TERMINAL_STATUS } from './constants'
1111
import './terminal.scss'
1212
import { TerminalViewType } from './terminal.type'
1313
import { restrictXtermAccessibilityWidth } from './terminal.utils'
14+
import { logExceptionToSentry } from '@devtron-labs/devtron-fe-common-lib'
15+
1416

1517
let clusterTimeOut
1618

@@ -177,6 +179,7 @@ export default function TerminalView({
177179
}
178180

179181
_socket.onclose = function (evt) {
182+
if (window._env_.LOG_TERMINAL_EVENTS_TO_SENTRY) logExceptionToSentry(evt)
180183
disableInput()
181184
_terminal.writeln('')
182185
_terminal.writeln('---------------------------------------------')

src/index.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ interface customEnv {
1212
SENTRY_PERFORMANCE_ENABLED?: boolean
1313
SENTRY_DSN?: string
1414
SENTRY_TRACES_SAMPLE_RATE?: number
15+
LOG_TERMINAL_EVENTS_TO_SENTRY?: boolean
1516
HOTJAR_ENABLED?: boolean
1617
CLUSTER_NAME?: boolean
1718
APPLICATION_METRICS_ENABLED?: boolean
@@ -121,6 +122,7 @@ if (!window || !window._env_) {
121122
SENTRY_PERFORMANCE_ENABLED: false,
122123
SENTRY_DSN: '',
123124
SENTRY_TRACES_SAMPLE_RATE: 0.2,
125+
LOG_TERMINAL_EVENTS_TO_SENTRY: false,
124126
HOTJAR_ENABLED: false,
125127
GA_ENABLED: false,
126128
GTM_ENABLED: false,

0 commit comments

Comments
 (0)