Skip to content

Commit b192fec

Browse files
author
Uroš Marolt
committed
better integration logging
1 parent 170bac9 commit b192fec

4 files changed

Lines changed: 11 additions & 6 deletions

File tree

backend/src/serverless/integrations/services/integrationProcessor.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -185,18 +185,22 @@ export class IntegrationProcessor extends LoggingBase {
185185
}
186186

187187
async processWebhook(webhookId: string, force?: boolean) {
188-
let logger = createChildLogger('processWebhook', this.log, { webhookId })
189-
logger.debug('Processing webhook!')
190-
191188
const options = (await SequelizeRepository.getDefaultIRepositoryOptions()) as IRepositoryOptions
192189
const repo = new IncomingWebhookRepository(options)
193190
const webhook = await repo.findById(webhookId)
191+
let logger = createChildLogger('processWebhook', this.log, { webhookId })
194192

195193
if (webhook === null || webhook === undefined) {
196194
logger.error('Webhook not found!')
197195
return
198196
}
199197

198+
logger = createChildLogger('processWebhook', this.log, {
199+
webhookId,
200+
tenantId: webhook.tenantId,
201+
})
202+
logger.debug('Processing webhook!')
203+
200204
logger = createChildLogger('processWebhook', this.log, {
201205
type: webhook.type,
202206
tenantId: webhook.tenantId,
@@ -287,6 +291,7 @@ export class IntegrationProcessor extends LoggingBase {
287291
async process(req: NodeWorkerIntegrationProcessMessage) {
288292
const logger = createChildLogger('process', this.log, {
289293
type: req.integrationType,
294+
tenantId: req.tenantId,
290295
integrationId: req.integrationId,
291296
onboarding: req.onboarding,
292297
microserviceId: req.microserviceId,

backend/src/serverless/integrations/usecases/discord/errorHandler.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,6 @@ export const handleDiscordError = (
2828

2929
return new RateLimitError(rateLimitResetSeconds, url, err)
3030
}
31-
logger.error({ err, input }, `Error while calling Slack API URL: ${url}`)
31+
logger.error(err, { input }, `Error while calling Slack API URL: ${url}`)
3232
return err
3333
}

backend/src/serverless/integrations/usecases/linkedin/errorHandler.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,6 @@ export const handleLinkedinError = (
2828
const rateLimitResetSeconds = nextMidnight.diff(now, 'seconds')
2929
return new RateLimitError(rateLimitResetSeconds, url, err)
3030
}
31-
logger.error({ err, input }, `Error while calling LinkedIn API URL: ${url}`)
31+
logger.error(err, { input }, `Error while calling LinkedIn API URL: ${url}`)
3232
return err
3333
}

backend/src/serverless/integrations/usecases/slack/errorHandler.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,6 @@ export const handleSlackError = (
2828

2929
return new RateLimitError(rateLimitResetSeconds, url, err)
3030
}
31-
logger.error({ err, input }, `Error while calling Slack API URL: ${url}`)
31+
logger.error(err, { input }, `Error while calling Slack API URL: ${url}`)
3232
return err
3333
}

0 commit comments

Comments
 (0)