-
Notifications
You must be signed in to change notification settings - Fork 766
-
Hi, thanks for creating this great module!
I'm working on a quite big project for a client, and certain big graphql queries start taking up quite some time.
That's why i'm looking into performance monitoring of my queries. I found the graphiql-debug-toolbar, but that is only giving me insight in the number of sql database hits.
two things:
- many of my resolver functions need to fetch data from an external time series database, which takes a bit of time. It would be nice to monitor how many calls to this external database were made.
- i would like to monitor the total time each resolver took while executing its function. It would be nice to return that as debug info, or inject it as comments in the query field of graphiql (if that is possible somehow).
Does anybody know how i could start developing such functionality, using middleware or ... ?
thanks!
Beta Was this translation helpful? Give feedback.
All reactions
Replies: 1 comment
-
One strategy for v3 would be to extend the ExecutionContext: https://github.com/graphql-python/graphql-core/blob/master/src/graphql/execution/execute.py You could wrap execute_operation
to collect timing stats from services.
Whether it's a custom execution context class or graphql middleware, the standard graphql view accepts either as arguments.
Beta Was this translation helpful? Give feedback.