reactioncommerce / reaction-feature-requests

Reaction Feature Requests
13 stars 1 forks source link

Instrument graphql monitoring metrics #60

Open focusaurus opened 5 years ago

focusaurus commented 5 years ago

Look into how to expose operational metrics around the graphql service including:

focusaurus commented 5 years ago

I did a fairly brief/cursory npm search and I'd propose starting with epimetheus

focusaurus commented 5 years ago

Here's the prometheus metrics we get from this.

metrics.txt

focusaurus commented 5 years ago

So there's a technical gotcha with the express instrumentation in that we need the instrumentation middleware to be added to the express app as early as possible, and specifically before the apollo graphql middleware, in order for the instrumentation to properly track request start times and responses. At the moment, there's no way to do this. createApolloServer.js creates the express app and adds apollo middleware right away. We need to design a clean mechanism for this.

@aldeed suggested something along the lines of a new Reaction.registerPackage() option loadFirstExpressMiddleware: [] but we need to think through the right mechanics and names, etc.