Skip to content
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

fix: Terminal events to sentry #1623

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,4 @@ LOGIN_DT_LOGO=
SIDEBAR_DT_LOGO=
USE_V2=
ENABLE_EXTERNAL_ARGO_CD=false
LOG_TERMINAL_EVENTS_TO_SENTRY=false
2 changes: 1 addition & 1 deletion src/components/ClusterNodes/ClusterTerminal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ export default function ClusterTerminal({
`user/terminal/get?namespace=${selectedNamespace.value}&shellName=${
selectedTerminalType.value
}&terminalAccessId=${terminalAccessIdRef.current}&containerName=${
resourceData.containers?.[0].containerName || ''
resourceData?.containers?.[0].containerName || ''
}`,
terminalAccessIdRef.current,
window?._env_?.CLUSTER_TERMINAL_CONNECTION_RETRY_COUNT || 7,
Expand Down
3 changes: 3 additions & 0 deletions src/components/terminal/TerminalWrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import { AppDetails } from '../app/types'
import './terminal.scss'
import { Scroller } from '../app/details/cicdHistory/History.components'
import { SocketConnectionType } from '../app/details/appDetails/appDetails.type'
import { logExceptionToSentry } from '@devtron-labs/devtron-fe-common-lib'


interface TerminalViewProps {
appDetails: AppDetails
Expand Down Expand Up @@ -270,6 +272,7 @@ export class TerminalView extends Component<TerminalViewProps, TerminalViewState
}

socket.onclose = function (evt) {
if (window._env_.LOG_TERMINAL_EVENTS_TO_SENTRY && evt.reason !== 'Normal closure') logExceptionToSentry(evt)
setSocketConnection('DISCONNECTED')
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import { TERMINAL_STATUS } from './constants'
import './terminal.scss'
import { TerminalViewType } from './terminal.type'
import { restrictXtermAccessibilityWidth } from './terminal.utils'
import { logExceptionToSentry } from '@devtron-labs/devtron-fe-common-lib'


let clusterTimeOut

Expand Down Expand Up @@ -183,6 +185,7 @@ export default function TerminalView({
}

_socket.onclose = function (evt) {
if (window._env_.LOG_TERMINAL_EVENTS_TO_SENTRY && evt.reason !== 'Normal closure') logExceptionToSentry(evt)
disableInput()
_terminal.writeln('')
_terminal.writeln('---------------------------------------------')
Expand Down
2 changes: 2 additions & 0 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ interface customEnv {
SENTRY_PERFORMANCE_ENABLED?: boolean
SENTRY_DSN?: string
SENTRY_TRACES_SAMPLE_RATE?: number
LOG_TERMINAL_EVENTS_TO_SENTRY?: boolean
HOTJAR_ENABLED?: boolean
CLUSTER_NAME?: boolean
APPLICATION_METRICS_ENABLED?: boolean
Expand Down Expand Up @@ -135,6 +136,7 @@ if (!window || !window._env_) {
SENTRY_PERFORMANCE_ENABLED: false,
SENTRY_DSN: '',
SENTRY_TRACES_SAMPLE_RATE: 0.2,
LOG_TERMINAL_EVENTS_TO_SENTRY: false,
HOTJAR_ENABLED: false,
GA_ENABLED: false,
GTM_ENABLED: false,
Expand Down
Loading