CloudWatch RUM (Real User Monitoring) not logging XHR API requests with React

0

Hello,

Testing out CloudWatch RUM. I have a single page React app that is making XHR requests out to the API services. These all show up on the browser network tab and the initiator changes from xhr.js to cwr.js when adding the embedded script in the <head> tab. I've tried setting pageIdFormat to PATH_AND_HASH, setting enableXRay to true, and setting [ 'http', { recordAllRequests: true, addXRayTraceIdHeader: true } ]

I see what appears to be xray events in the fetch call out to the RUM data collector, but it doesn't capture the api method name or path in the "Requests" section of RUM dashboard. For example, the api calls from example.com/#profile are POSTs to something like example.com/api/serviceABC and I was hoping to get serviceABC request times on the RUM dashboard.

Taking the xray ID from the browser's network tab, I can find the ID in the xray dashboard, but the request and response fields are all blank and there is no way to see what service was called.

질문됨 2년 전1332회 조회
2개 답변
1

Hello, and thanks for reaching out!

RUM at the moment will not capture API methods/path information and save it as an event. This is why you won’t see it on the dashboard.We also only capture HTTP requests that are not successful (i.e, non 200) - We will display these failed requests in the Errors & Sessions tab. https://docs.aws.amazon.com/cloudwatchrum/latest/APIReference/API_AppMonitorConfiguration.html

For route change timing, we only capture the duration of a route change - in the future, we will be extending this functionality to break down the route changes and specify how long each underlying request took.

To summarize unfortunately, at this moment we cannot see what service was called in RUM dashboard as we only capture HTTP requests that are not successful.

AWS
지원 엔지니어
답변함 2년 전
1

I ended up forking the aws-rum-web client for our use case (capture all API calls ignoring sampling and max event count). Not a global fix, but may be useful for others

https://github.com/samholton/aws-rum-web/releases/tag/v1.5.1-api-patch

답변함 2년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠