graphql-perf

0.0.1 • Public • Published

graphql-perf

Gather performance information from GraphQL resolve methods and prepare JSON in Trace Event Format for Chrome Devtools Timeline.

screen shot 2016-11-05 at 9 51 50

Current plans/aims/thoughts

  • VIEW: responsive timeline graphics in Google Chrome Devtools
    • just click a link in browser console or press a button in extension
    • you will measure only current request
    • no need to setup special server or buy a subscription, eg. Apollo Optics
    • if you need aggregated statistics use Apollo Optics 😉
  • SERVER: should work with any GraphQL Schema under nodejs
    • but if schema built with https://github.com/nodkz/graphql-compose-mongoose (and other graphql-compose libs) will have additional profiling info
    • should have api that allows other libs to provide extended perf metrics
    • will integrate it with express-graphql
    • but also may be integrated with apollo-server and others
  • CLIENT: should have link, button, extension that open Devtools Timeline
    • perf data will be in the json-response from graphql server under extensions.perf path in it.
    • will integrate it with https://github.com/nodkz/react-relay-network-layer
    • so needs help in passing this data to Devtools Timeline (some link or chrome extension) or some another way.
  • OTHER SERVERS:
    • maybe somebody writes for other languages similar perf export in Trace Event Format under extensions.perf path in graphql response.

I'll try to start it at the end of November/December. Too much work right now.

Did you have experience with Trace Event Format? Or maybe want help? Or start to develop such thing right now? Or maybe can recommend additional sources/articles? Feel free to open issue. Will be glad to any help and thoughts.

How it should work under the hood

This package should traverse by types and fields (of provided GraphQL Schema instance) wraps all resolvers and return new wrapped Schema in build phase (when nodejs starts your server). After that for every request, when server gets ?perf=1 param (or some other key in headers) it will pass wrapped schema to graphql-express, otherwise for regular users your initial schema for performance reasons. It will be safe to use it in production, without losing performance. Gathered trace information should be written to the GraphQL response extensions.perf key in the Trace Event Format.

Useful links

Cybersquatting

I'm reserved graphql-perf name in npmjs, cause think that only such module may have so brave name. 😉

PS. I with pleasure free this name, if somebody made the same module or even better, until I began to develop.

Package Sidebar

Install

npm i graphql-perf

Weekly Downloads

0

Version

0.0.1

License

MIT

Last publish

Collaborators

  • nodkz