I have multiple Lambdas and each of them either invoke another lambda or a rest API or a dynamoDB or S3 etc .
Example :
These invoke the common services like
I need to track which application i.e Flight Booking / HotelBooking is invoking the booking service and how many times / how much CPU etc
Is this possible through X-Ray in AWS or any other better ways ?
After some research, I believe annotation is the best way for the above problem
So we need to add an annotation in NodeJS
AWSXRay.captureFunc('annotations', (subsegment) => {
subsegment.addAnnotation('application', "BookingService");
});
Annotations are indexed and can be used to filter too using an expression like this annotation.= "BookingService"
more Info : X-ray merges segments, Subsegments to traces so the annotation at subsegment level is enough for filtering the traces