2

I am running lambda in AWS and enabled xray. Below is a code I use to create a subsegment inside lambda. I can see this subsegment when I click a trace. How can I search all traces with this subsegment by name in xray console?

await AWSXRay.captureAsyncFunc('create-connection', async () => {
...
Joey Yi Zhao
  • 37,514
  • 71
  • 268
  • 523

1 Answers1

1

In the X-Ray console, you can only search for traces with segment names as each segment typically represents a service. Subsegment names searches are not supported.

What you can do instead is add an annotation to the created subsegment. Something like this should work:

await AWSXRay.captureAsyncFunc('create-connection', function(subsegment) => {
  subsegment.addAnnotation("mykey", "my value");
  ...

Since annotations are indexed, in the X-Ray console you can search traces with annotation like annotation.mykey = "my value"