Skip to content

Commit

Permalink
chore(plugin-server): don't send event pipeline stall warnings to sen…
Browse files Browse the repository at this point in the history
…try (#20585)
  • Loading branch information
bretthoerner authored Feb 27, 2024
1 parent 516493f commit 29f423c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
7 changes: 5 additions & 2 deletions plugin-server/src/utils/db/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,15 @@ export function sanitizeEventName(eventName: any): string {
export function timeoutGuard(
message: string,
context?: Record<string, any> | (() => Record<string, any>),
timeout = defaultConfig.TASK_TIMEOUT * 1000
timeout = defaultConfig.TASK_TIMEOUT * 1000,
sendToSentry = true
): NodeJS.Timeout {
return setTimeout(() => {
const ctx = typeof context === 'function' ? context() : context
status.warn('⌛', message, ctx)
Sentry.captureMessage(message, ctx ? { extra: ctx } : undefined)
if (sendToSentry) {
Sentry.captureMessage(message, ctx ? { extra: ctx } : undefined)
}
}, timeout)
}

Expand Down
4 changes: 3 additions & 1 deletion plugin-server/src/worker/ingestion/event-pipeline/runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ export class EventPipelineRunner {
description: step.name,
},
async () => {
const sendToSentry = false
const timeout = timeoutGuard(
`Event pipeline step stalled. Timeout warning after ${this.hub.PIPELINE_STEP_STALLED_LOG_TIMEOUT} sec! step=${step.name} team_id=${teamId} distinct_id=${this.originalEvent.distinct_id}`,
{
Expand All @@ -166,7 +167,8 @@ export class EventPipelineRunner {
teamId: teamId,
distinctId: this.originalEvent.distinct_id,
},
this.hub.PIPELINE_STEP_STALLED_LOG_TIMEOUT * 1000
this.hub.PIPELINE_STEP_STALLED_LOG_TIMEOUT * 1000,
sendToSentry
)
try {
const result = await step(...args)
Expand Down

0 comments on commit 29f423c

Please sign in to comment.