Skip to content

Commit

Permalink
Use revised TransactionObservabilityManager signature that prevents o…
Browse files Browse the repository at this point in the history
…verwriting ongoing transactions with the same span id (#138)
  • Loading branch information
kibertoad authored May 4, 2024
1 parent 5e4713d commit 101810d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
6 changes: 5 additions & 1 deletion packages/amqp/lib/AbstractAmqpConsumer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,11 @@ export abstract class AbstractAmqpConsumer<
deserializedMessage.result[this.messageTypeField]
}`

this.transactionObservabilityManager?.start(transactionSpanId)
this.transactionObservabilityManager?.start(
transactionSpanId,
// @ts-ignore
deserializedMessage.result[this.messageIdField],
)
if (this.logMessages) {
const resolvedLogMessage = this.resolveMessageLog(deserializedMessage.result, messageType)
this.logMessage(resolvedLogMessage)
Expand Down
2 changes: 1 addition & 1 deletion packages/core/lib/types/MessageQueueTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export interface AsyncPublisher<MessagePayloadType, MessageOptions> {
}

export type TransactionObservabilityManager = {
start: (transactionSpanId: string) => unknown
start: (transactionSpanId: string, uniqueTransactionKey: string) => unknown
stop: (transactionSpanId: string) => unknown
}

Expand Down
6 changes: 5 additions & 1 deletion packages/sqs/lib/sqs/AbstractSqsConsumer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,11 @@ export abstract class AbstractSqsConsumer<
const messageType = deserializedMessage.result[this.messageTypeField]
const transactionSpanId = `queue_${this.queueName}:${messageType}`

this.transactionObservabilityManager?.start(transactionSpanId)
this.transactionObservabilityManager?.start(
transactionSpanId,
// @ts-ignore
deserializedMessage.result[this.messageIdField],
)
if (this.logMessages) {
const resolvedLogMessage = this.resolveMessageLog(deserializedMessage.result, messageType)
this.logMessage(resolvedLogMessage)
Expand Down

0 comments on commit 101810d

Please sign in to comment.