Skip to content

Commit

Permalink
feat: add originalTraceId header in error topic exception filter
Browse files Browse the repository at this point in the history
  • Loading branch information
KillWolfVlad committed Jan 22, 2024
1 parent 6971db3 commit 30a1cee
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ export class KafkaConsumerErrorTopicExceptionFilter
originalPartition: String(payload.rawPayload.partition),
originalOffset: payload.rawPayload.message.offset,
originalTimestamp: payload.rawPayload.message.timestamp,
originalTraceId: context.traceId,
error: JSON.stringify(serializeError(cause)),
},
},
Expand Down
1 change: 1 addition & 0 deletions src/consumer/interfaces/kafkaConsumerContextInterface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,5 @@ export interface IKafkaConsumerContext {
readonly kafkaConsumerMessageHandlerLogger: KafkaConsumerMessageHandlerLogger;

readonly isFinalAttempt: boolean;
readonly traceId: string;
}
1 change: 1 addition & 0 deletions src/consumer/kafkaConsumerMessageHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ export class KafkaConsumerMessageHandler {
kafkaConsumerMessageHandlerLogger:
this.kafkaConsumerMessageHandlerLogger,
isFinalAttempt,
traceId: rootSpan.context().toTraceId(),
};

const resultOrStream = await messageHandler(payload, context);
Expand Down

0 comments on commit 30a1cee

Please sign in to comment.