Skip to content

Apollo GQL integration not tracing calls #3038

@ersen-lw

Description

@ersen-lw

Describe the bug

I noticed the GQL calls are not being traced in RUM. The events have 0 resources tracked.
The GQL requests is missing the following headers:

_dd-custom-header-graph-ql-operation-name: {OP Name}
_dd-custom-header-graph-ql-operation-type: query 
_dd-custom-header-graph-ql-variables: {} 

Reproduction steps

My app is a mix of REST and GQL. They share the same OkHttp client. The OkHttp client has the DatadogInterceptor added to it. I then added the DatadogApolloInterceptor to the Apollo client.

I observed that when both is added then the GQL call will not have these headers.

_dd-custom-header-graph-ql-operation-name: {OP Name}
_dd-custom-header-graph-ql-operation-type: query 
_dd-custom-header-graph-ql-variables: {} 

It will instead have these headers

x-apollo-operation-name:         OpName
x-datadog-origin:                rum
x-datadog-parent-id:             ID
x-datadog-sampling-priority:     1
x-datadog-tags:                  _dd.p.dm=-0,_dd.p.tid=ID
x-datadog-trace-id:              ID

When I remove the DatadogInterceptor then I am able to see GQL headers.

However I noticed that after only including the DatadogApolloInterceptor that I still do not see the GQL call traced in the resources tab.

Logcat logs

I don't see any warning or error logs from datadog related to this issue

Expected behavior

  • GQL call should be traced
  • I should be able to share a OkHttpClient between Apollo and REST
  • REST should use the DatadogInterceptor
  • GQL should use DatadogApolloInterceptor

Affected SDK versions

3.3.0

Latest working SDK version

N/A

Did you confirm if the latest SDK version fixes the bug?

Yes

Kotlin / Java version

2.2.21

Gradle / AGP version

gradle-8.13 / AGP-8.12.2

Other dependencies versions

okhttp 4.12.0

Device Information

Tested so far on a Pixel 8 emulator running Android 15 (API 35)

Other relevant information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions