aws / aws-xray-sdk-node

The official AWS X-Ray SDK for Node.js.
Apache License 2.0
266 stars 155 forks source link

Consider supporting SQL annotations for Athena calls. #623

Open kitsunde opened 10 months ago

kitsunde commented 10 months ago

Hello,

I understand X-Ray currently only support MySQL and Postgres drivers. We use the Postgres annotation frequently to investigate issues, it would be nice if SQL annotations could be added for athena as well.

jj22ee commented 8 months ago

Hi, can you clarify what is your requirement?

If your goal is to add an XRay Annotation to an Athena subsegment (presumable made via AWS SDK), you can try the following code example to add an annotation to the last created subsegment. (referenced from docs)

/*
  Athena call via AWS SDK
*/

// Retrieve the most recently created subsegment
const subs = AWSXRay.getSegment().subsegments;

if (subs & & subs.length > 0) {
  var lastSubsegment = subs[subs.length - 1];
  lastSubsegment.addAnnotation("testKey", "testValue");
}