Skip to content

Preserve tracing using sqs-consumer. #419

@hariharasudhan-nineleaps

Description

I have two microservices namely user-service and notification-service, whenever user sign-up to user-service. the message will add to sqs queue with AWSTraceHeader, now from notification-service sqs-consumer will poll and pass that message to handleMessage callback function and send an email to enduser using SES.

I can able to trace the process till, user-service ---> sqs queue, but how can traceId entire flow like user-service->queue->notification-service->ses. I tried the following code

handleMessage: async (message: SQS.Message) => {
    const segment = AWSXRay.getSegment()
    if(segment){
      segment.trace_id = message.Attributes?.AWSTraceHeader
    }
    
    await wiring.sqsService.handleMessage(message);
  }

but got the error like below
Property 'trace_id' does not exist on type 'Segment | Subsegment'. Property 'trace_id' does not exist on type 'Subsegment'.

How can I trace the entire process?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions