Skip to content

Commit

Permalink
chore: log slow warnings relative to external request timeout (#17821)
Browse files Browse the repository at this point in the history
  • Loading branch information
tiina303 authored Oct 5, 2023
1 parent 476d102 commit cc2c28a
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions plugin-server/src/worker/ingestion/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -364,12 +364,15 @@ export class HookCommander {
const message = this.formatMessage(webhookUrl, action, event, team)
end()

const slowWarningTimeout = this.EXTERNAL_REQUEST_TIMEOUT * 0.7
const timeout = setTimeout(() => {
status.warn(
'⌛',
`Posting Webhook slow. Timeout warning after 5 sec! url=${webhookUrl} team_id=${team.id} event_id=${event.eventUuid}`
`Posting Webhook slow. Timeout warning after ${
slowWarningTimeout / 1000
} sec! url=${webhookUrl} team_id=${team.id} event_id=${event.eventUuid}`
)
}, 5000)
}, slowWarningTimeout)
const relevantFetch =
isCloud() && (!this.fetchHostnameGuardTeams || this.fetchHostnameGuardTeams.has(team.id))
? safeTrackedFetch
Expand Down Expand Up @@ -443,12 +446,15 @@ export class HookCommander {
data: { ...data, person: sendablePerson },
}

const slowWarningTimeout = this.EXTERNAL_REQUEST_TIMEOUT * 0.7
const timeout = setTimeout(() => {
status.warn(
'⌛',
`Posting RestHook slow. Timeout warning after 5 sec! url=${hook.target} team_id=${event.teamId} event_id=${event.eventUuid}`
`Posting RestHook slow. Timeout warning after ${slowWarningTimeout / 1000} sec! url=${
hook.target
} team_id=${event.teamId} event_id=${event.eventUuid}`
)
}, 5000)
}, slowWarningTimeout)
const relevantFetch =
isCloud() && (!this.fetchHostnameGuardTeams || this.fetchHostnameGuardTeams.has(hook.team_id))
? safeTrackedFetch
Expand Down

0 comments on commit cc2c28a

Please sign in to comment.