-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Graphql requests are not monitoring friendly #7130
Comments
This is currently impacting our ability to monitor perf related to Apollo client generated requests. It would be great to come up with a solution that would avoid brittle ordering issues. |
Hi @bcaudan, thanks for your patience! Would passing the overridden |
Hi @arminrosu 👋🏻 I see you reacted to the above comment - can you elaborate so that we can better understand your use case and narrow down our options here? |
@bignimbus gladly, thanks for the interest. I'm trying to set up Datadog tracing from the client down to our backend services. Datadog does this by setting some headers on GQL requests. They probably do this by wrapping browser requests and appending their headers. It works if I initialise datadog before the apollo client. But then I started having issues with Apollo Cache. I dropped the topic for now, but that's essentially it. I haven't tried setting a custom |
Thanks @arminrosu - looking at the Datadog SDK now. This snippet was interesting to me. It does seem like something that would be resolved by, as you said, initializing the Datadog SDK before Apollo Client.
That's also interesting and something that might be worth getting more detail on - what issues did you see? Is this a bug in Apollo Client? |
I'll get back to you once I give this one another shot. I haven't had time to look into it closely yet. |
Hi @arminrosu 👋 Just following up here and was curious if there are any more details you or other participants on this issue can provide to @bignimbus's question above re: downsides to initializing DD SDK before Apollo Client. Thanks! |
@alessbell thanks for checking in. No complaints from doing this. We now have it in production for a few months and everything is working fine. |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Intended outcome:
Be able to monitor graphql requests through a third party monitoring library.
Actual outcome:
Third party monitoring library override global fetch to gather data on each request.
Since
createHttpLink
keep a reference to fetch (code), if global fetch is instrumented aftercreateHttpLink
execution then graphql requests can't be instrumented.How to reproduce the issue:
with a simple fetch override:
if executed before
ApolloClient
initialization, graphql requests are loggedif executed after
ApolloClient
initialization, graphql requests are not loggedVersions
master
The text was updated successfully, but these errors were encountered: