2

I just connected Datadog RUM on my React SPA application, this application is not connected to a backend but uses graphql apis from another application which has Datadog tracing agent set on it

datadogRum.init({
  applicationId: 'xxxxxxxxx',
  clientToken: 'xxxxxxxxxxxxxx',
  site: 'datadoghq.com',
  service: 'order',
  env: 'staging',
  // Specify a version number to identify the deployed version of your application in Datadog
  // version: '1.0.0',
  sampleRate: 100,
  premiumSampleRate: 100,
  trackInteractions: true,
  defaultPrivacyLevel: 'mask-user-input',
  allowedTracingOrigins: [/https:\/\/(?:api|app)\.example\.(?:cc|com)\/graphql/],
})

I already have datadog tracing agent set on. app.example.com which is a monolith Ruby on rails application but also exposes a graphql api

I want to be able to get the graphql calls made from the React frontend to the ROR app on the Datadog RUM traces tab, but with my current setup nothing happens.
on the Datadog docs these are the prerequisite for this to work.

  • You have set up APM tracing on the services targeted by your RUM applications.
  • Your services use an HTTP server.
  • Your HTTP servers are using a library that supports distributed tracing.
  • You have XMLHttpRequest (XHR) or Fetch resources on the RUM Explorer to your allowedTracingOrigins.
  • You have a corresponding trace for requests to allowedTracingOrigins.

I think I have all those met I am not completely sure, but my question is how do I properly connect Datadog RUM to traces.

Noriode Raphael
  • 88
  • 1
  • 11
  • Have you checked to make sure that your GraphQL service is allowing the necessary [headers](https://docs.datadoghq.com/real_user_monitoring/connect_rum_and_traces/?tab=browserrum#how-are-rum-resources-linked-to-traces)? – Eric Allen Jul 29 '22 at 12:58
  • yes it does in my graphql header setting I allow any header. @EricAllen – Noriode Raphael Aug 01 '22 at 05:52
  • Do you see the headers being sent by your UI and do you see them coming through to your GraphQL service? The `x-datadog-*` headers are what is supposed to allow Datadog to link RUM resources to traces. – Eric Allen Aug 01 '22 at 13:32
  • ```:authority: rum.browser-intake-datadoghq.com :method: POST :path: /api/v2/rum?ddsource=browser&ddtags=sdk_version....... :scheme: https accept: */* content-type: text/plain;charset=UTF-8 origin: https://localhost:3000 referer: https://localhost:3000/ sec-ch-ua: ".Not/A)Brand";v="99", "Google Chrome";v="103", "Chromium";v="103" sec-ch-ua-mobile: ?0 sec-ch-ua-platform: "macOS" sec-fetch-dest: empty sec-fetch-mode: no-cors sec-fetch-site: cross-site user-agent: ..... ``` no I do not see the header being sent this is an example request header from datadog @EricAllen – Noriode Raphael Aug 02 '22 at 06:53
  • and sorry for some reason code formatting doesn't work for me @EricAllen – Noriode Raphael Aug 02 '22 at 06:54

1 Answers1

0

I ran in to this issue and had to update my rum npm package, it was too old.