Skip to content

RUM-11196: Support apollo graphql#2845

Merged
jonathanmos merged 11 commits into
developfrom
jmoskovich/rum-11196/apollo-integration
Sep 30, 2025
Merged

RUM-11196: Support apollo graphql#2845
jonathanmos merged 11 commits into
developfrom
jmoskovich/rum-11196/apollo-integration

Conversation

@jonathanmos

@jonathanmos jonathanmos commented Sep 1, 2025

Copy link
Copy Markdown
Member

What does this PR do?

Adds support for Apollo GraphQL requests, which is essentially native support for graphQL (until now only available from cross-platform).

Caveats:
Support only for V4 of Apollo-Kotlin. If there will be enough demand for V3 we may extend support there.

How does it work:

  • Added a new ApolloInterceptor plugin under a new integration module: dd-sdk-android-apollo
  • This plugin adds some headers to graphQL requests containing request fields: operationName, operationType, variables and payload.
  • Added logic inside DatadogInterceptor to catch these headers and send them as part of RumResourceScope. After extracting the data from these headers they are removed so they won't be sent onwards to the host.
  • All the fields are sent by default with the exception of payload. To send it the user must set a new configuration option inside the DatadogApolloInterceptor constructor -> DatadogApolloInterceptor(sendGraphQLPayloads = true)
  • To setup, the user adds our ApolloInterceptor plugin to their ApolloClient configuration (as described in the Readme)

Motivation

Add GraphQL support to native.

Additional Notes

Anything else we should know when reviewing?

  • Notice that we can't test this at the moment as part of the sample because it's graphQL. This means that the payload flag is also not added to the sampleApplication because it would have no effect. I'm testing it manually but we'll have to create an automatic testing solution.
  • The new module adds about 4MB in terms of dependency size and two additional MIT dependency licenses (apollo-kotlin and a uuid dependency that apollo-kotlin uses internally).

Review checklist (to be filled by reviewers)

  • Feature or bugfix MUST have appropriate tests (unit, integration, e2e)
  • Make sure you discussed the feature or bugfix with the maintaining team in an Issue
  • Make sure each commit and the PR mention the Issue number (cf the CONTRIBUTING doc)

@jonathanmos
jonathanmos marked this pull request as ready for review September 1, 2025 08:53
@jonathanmos
jonathanmos requested review from a team as code owners September 1, 2025 08:53

@0xnm 0xnm left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I briefly reviewed the RUM module part of it and left some suggestions.

It is good to see finally GraphQL support in the SDK!

ambushwork
ambushwork previously approved these changes Sep 2, 2025
Comment thread integrations/dd-sdk-android-apollo/transitiveDependencies
Comment thread integrations/dd-sdk-android-apollo/build.gradle.kts Outdated
@urseberry urseberry self-assigned this Sep 2, 2025
Comment thread integrations/dd-sdk-android-apollo/README.md Outdated
Comment thread integrations/dd-sdk-android-apollo/README.md Outdated
Comment thread integrations/dd-sdk-android-apollo/README.md Outdated
Comment thread integrations/dd-sdk-android-apollo/README.md Outdated
Comment thread integrations/dd-sdk-android-apollo/README.md Outdated
Comment thread integrations/dd-sdk-android-apollo/README.md Outdated
Comment thread features/dd-sdk-android-rum/api/apiSurface Outdated
Comment thread integrations/dd-sdk-android-apollo/api/apiSurface Outdated
Comment thread integrations/dd-sdk-android-apollo/README.md Outdated
@jonathanmos
jonathanmos force-pushed the jmoskovich/rum-11196/apollo-integration branch 2 times, most recently from ba2a0f6 to 287327c Compare September 8, 2025 08:44
@jonathanmos
jonathanmos force-pushed the jmoskovich/rum-11196/apollo-integration branch from 287327c to e19f43a Compare September 9, 2025 08:24
@codecov-commenter

codecov-commenter commented Sep 9, 2025

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 65.81197% with 40 lines in your changes missing coverage. Please review.
✅ Project coverage is 70.86%. Comparing base (8a51cb5) to head (c917655).
⚠️ Report is 1491 commits behind head on develop.

Files with missing lines Patch % Lines
...n/com/datadog/android/okhttp/DatadogInterceptor.kt 60.98% 14 Missing and 2 partials ⚠️
...roid/rum/internal/domain/scope/RumResourceScope.kt 58.33% 15 Missing ⚠️
...datadog/android/internal/network/GraphQLHeaders.kt 0.00% 5 Missing ⚠️
...datadog/android/apollo/DatadogApolloInterceptor.kt 93.33% 1 Missing and 1 partial ⚠️
...droid/apollo/internal/DefaultVariablesExtractor.kt 60.00% 2 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #2845      +/-   ##
===========================================
+ Coverage    70.81%   70.86%   +0.06%     
===========================================
  Files          809      812       +3     
  Lines        29482    29586     +104     
  Branches      4940     4955      +15     
===========================================
+ Hits         20875    20966      +91     
- Misses        7246     7265      +19     
+ Partials      1361     1355       -6     
Files with missing lines Coverage Δ
...datadog/android/apollo/DatadogApolloInterceptor.kt 93.33% <93.33%> (ø)
...droid/apollo/internal/DefaultVariablesExtractor.kt 60.00% <60.00%> (ø)
...datadog/android/internal/network/GraphQLHeaders.kt 0.00% <0.00%> (ø)
...roid/rum/internal/domain/scope/RumResourceScope.kt 91.79% <58.33%> (-2.48%) ⬇️
...n/com/datadog/android/okhttp/DatadogInterceptor.kt 75.00% <60.98%> (-4.43%) ⬇️

... and 34 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

urseberry
urseberry previously approved these changes Sep 9, 2025

@0xnm 0xnm left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks alright! I've added a few comments and suggestions.

Comment thread detekt_custom_safe_calls.yml Outdated
@jonathanmos
jonathanmos requested a review from 0xnm September 17, 2025 09:21

@0xnm 0xnm left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall lgtm, I've added some questions

@jonathanmos
jonathanmos force-pushed the jmoskovich/rum-11196/apollo-integration branch 4 times, most recently from 0d902cc to 1e45cb9 Compare September 29, 2025 12:39
@jonathanmos
jonathanmos requested a review from 0xnm September 29, 2025 13:52
Comment thread reliability/single-fit/okhttp/build.gradle.kts Outdated
Comment thread reliability/single-fit/okhttp/build.gradle.kts Outdated
@jonathanmos
jonathanmos force-pushed the jmoskovich/rum-11196/apollo-integration branch 2 times, most recently from 752e009 to 6d95d94 Compare September 30, 2025 11:32
@jonathanmos
jonathanmos requested a review from 0xnm September 30, 2025 12:43
0xnm
0xnm previously approved these changes Sep 30, 2025
@jonathanmos
jonathanmos force-pushed the jmoskovich/rum-11196/apollo-integration branch from 6d95d94 to c917655 Compare September 30, 2025 13:31
@jonathanmos
jonathanmos merged commit fa39327 into develop Sep 30, 2025
25 checks passed
@jonathanmos
jonathanmos deleted the jmoskovich/rum-11196/apollo-integration branch September 30, 2025 15:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants