Query X-Ray trace data

Query AWS X-Ray

Select AWS services from the AWS logo on the left navigation bar, which will take you to the screen as shown below showing all the AWS data sources available for you to choose from.

Data sources

Select X-Ray from the list, select the AWS Region where the PetAdoptions application is deployed and click on Add data source to add X-Ray as a data source.

XRay data source

Create a new Dashboard, or if you already have created a Dashboard, simply add a new Grafana Panel.

Select X-Ray as the data source and paste the following X-Ray filter expression in the query text box. This filter expression will show only the traces between the PetSite and the payforadoption services

edge("PetSite", "payforadoption")

Traces

Copy and paste the following Filter expression into the Query text box.

Annotation.PetType = "bunny" OR Annotation.PetType = "puppy"

You can also go to AWS X-Ray directly by simply clicking on the TraceID shown in the results.

Traces

Now simply paste the following expression to see all the traces between the services PetSite and payforadoption and that have annotation PetType=bunny.

edge("PetSite", "payforadoption") AND Annotation.PetType="bunny"

Change the visualization to Stat to see the graph as shown below.

PetType Bunny

Click on one of the Trace IDs to see the segment graph as similar to the one below

Segment graph