From 79e597907eee126b4187e4534b2aa2253d1431da Mon Sep 17 00:00:00 2001 From: shrouti1507 <60211312+shrouti1507@users.noreply.github.com> Date: Mon, 18 Nov 2024 14:49:18 +0530 Subject: [PATCH] fix: adding logger for undefined source event (#3879) * fix: adding logger for undefined source event * fix: review comment addressed * chore: enrich metadata, update error msg in logger * chore: code review updates --------- Co-authored-by: Sai Sankeerth --- src/controllers/source.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/controllers/source.ts b/src/controllers/source.ts index 8b6d2d70f84..3d9fa4f4a45 100644 --- a/src/controllers/source.ts +++ b/src/controllers/source.ts @@ -11,6 +11,11 @@ export class SourceController { const requestMetadata = MiscService.getRequestMetadata(ctx); const events = ctx.request.body as object[]; const { version, source }: { version: string; source: string } = ctx.params; + const enrichedMetadata = { + ...requestMetadata, + source, + version, + }; const integrationService = ServiceSelector.getNativeSourceService(); try { @@ -28,6 +33,7 @@ export class SourceController { ); ctx.body = resplist; } catch (err: any) { + logger.error(err?.message || 'error in source transformation', enrichedMetadata); const metaTO = integrationService.getTags(); const resp = SourcePostTransformationService.handleFailureEventsSource(err, metaTO); ctx.body = [resp];