Skip to content

Commit

Permalink
chore(plugin-server): lazily json serialize some timeoutguard context
Browse files Browse the repository at this point in the history
  • Loading branch information
bretthoerner committed Apr 3, 2024
1 parent 3eef870 commit e15a798
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
4 changes: 2 additions & 2 deletions plugin-server/src/worker/ingestion/event-pipeline/runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,12 +165,12 @@ export class EventPipelineRunner {
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}`,
{
() => ({
step: step.name,
event: JSON.stringify(this.originalEvent),
teamId: teamId,
distinctId: this.originalEvent.distinct_id,
},
}),
this.hub.PIPELINE_STEP_STALLED_LOG_TIMEOUT * 1000,
sendToSentry
)
Expand Down
7 changes: 4 additions & 3 deletions plugin-server/src/worker/ingestion/process-event.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,10 @@ export class EventsProcessor {
eventUuid: string
): Promise<PreIngestionEvent> {
const singleSaveTimer = new Date()
const timeout = timeoutGuard('Still inside "EventsProcessor.processEvent". Timeout warning after 30 sec!', {
event: JSON.stringify(data),
})
const timeout = timeoutGuard(
'Still inside "EventsProcessor.processEvent". Timeout warning after 30 sec!',
() => ({ event: JSON.stringify(data) })
)

let result: PreIngestionEvent | null = null
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,12 @@ export class PropertyDefinitionsManager {
}

const timer = new Date()
const timeout = timeoutGuard('Still running "updateEventNamesAndProperties". Timeout warning after 30 sec!', {
event: event,
})
const timeout = timeoutGuard(
'Still running "updateEventNamesAndProperties". Timeout warning after 30 sec!',
() => ({
event: event,
})

This comment has been minimized.

Copy link
@bretthoerner

bretthoerner Apr 4, 2024

Author Contributor

Oops, guess I didn't need to wrap this one (no harm, though). I do wonder why the others JSON.stringify and this one doesn't.

)

try {
const team: Team | null = await this.teamManager.fetchTeam(teamId)
Expand Down

0 comments on commit e15a798

Please sign in to comment.