Skip to content
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

Support Apollo Tracing #289

Open
jsaur opened this issue Jun 19, 2018 · 2 comments
Open

Support Apollo Tracing #289

jsaur opened this issue Jun 19, 2018 · 2 comments

Comments

@jsaur
Copy link

jsaur commented Jun 19, 2018

It would be great to be able to leverage Apollo Engine for performance tracing (https://www.apollographql.com/docs/engine/performance.html). I believe in order to do that we would need to implement an apollo-tracing extension in PHP (https://github.com/apollographql/apollo-tracing).

@vladar
Copy link
Member

vladar commented Jun 23, 2018

Hey, we discussed this feature couple times. Please check #200 and #94 for reference.

In short, we discussed two ways how to do this at the library level:

  1. Add a mechanism for logging and metadata collection (we'll do this after the reference implementation, see Execution & Error Logging graphql/graphql-js#284)

  2. Loop through all types in a schema and wrap all field resolvers of all types with apollo-metrics closure. Apollo JS server does this. The problem with this approach in PHP is that schema is created on each request (vs once in nodejs), so there is a huge overhead when doing so.

  3. Current workaround: wrap all resolvers in the userland code when defining a type.

But we've got type loading mechanism since then and I think we can do something else now: we can wrap type loader with our own closure which will, in turn, wrap all field resolvers of a type being loaded.

So any schema using type loading can benefit from it. It will be still not ideal in terms of performance (still have to loop through all fields of all types loaded during a query), but it will be way more performant than full schema scan.

PRs are welcome! I guess we can just write a simple function somewhere under GraphQL\Utils for such a wrapper.

@spawnia
Copy link
Collaborator

spawnia commented Jun 9, 2022

This feature is implemented in Lighthouse - see https://github.com/nuwave/lighthouse/tree/master/src/Tracing.

@spawnia spawnia changed the title New feature: add apollo-tracing extension Support Apollo Tracing Jun 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants