How do I query X-ray using a http URL, where that URL is not the first part of the request?

0

Hello.

Suppose that I have the following architecture:

API Gateway (service name: gateway api) -> Lambda Function (service name: gateway handler) -> API Gateway (service name: internal service) -> Lambda Function (service name: internal service handler)

The "internal service" api gateway has 2 endpoints (POST /endpointA and POST /endpointX), which both proxy to the same "handler" lambda function. Depending on a feature flag, incoming requests are requests to the "gateway handler" are sent to either POST /endpointA or POST /endpointX. All of these services are set up for tracing with AWS X-ray.

I want to query X-Ray to gain insights into the performance of requests send to X vs A.

I tried the following query

service("gateway handler") AND service("internal service") AND http.url ENDSWITH "/endpointX"
// and also //
service("gateway handler") AND service("internal service") AND http.url ENDSWITH "/endpointA"

However this does not seem to work. In general I cannot query using http.url, when that http request is not the first request in a trace.

Is there a way around this? Bonus points if it does not require me to add additional code to annotate traces for the xray system.

1 個回答
0

Hi Dilski,

As you observed, all of the http filters are scoped to only the root segment of the trace. This means that it is not possible to filter on http.url for a downstream segment. In your case, I would suggest that the internal service node be split into two, one for each API. This would let you view the aggregated statistics of each endpoint separately on the service graph and to filter the traces with the expressions

service("gateway handler") AND service("internal service /endpointA")
or
service("gateway handler") AND service("internal service /endpointX")

Hope this helps!

AWS
lexgu
已回答 2 年前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南