-
Notifications
You must be signed in to change notification settings - Fork 537
support graphql request metrics trace #107
Comments
I think right now you'd have to write a custom express middleware that extracts this. It seems like it might be useful to have this data somewhere that's easily accessible from application code. In express itself the request object serves this purpose of exposing information about the transport layer - there's lots of fields like headers and ips and proxy information and so on, which mostly you can ignore, but occasionally you want to access. In express-graphql there is not really a logical place to put this sort of request-parsing-byproduct right now though. |
Perhaps koa's middleware model would be better for something like this at the moment since it lets you set up metadata that wraps the result of a lower middleware. Koa support isn't built in yet, but probably should be soon, in the meantime there are some koa plugins out there that would let you do this. |
Here's my solution (will send a PR if anyone thinks it's useful). server.js
logger.js
|
In graphql,all request is POST and in the same url.
Because of this,the server side can not distinguish which request is slow.
In below query,is there any way to get the
TestQuery
value before graphql execute so I can trace the query name and log it's cost time?The text was updated successfully, but these errors were encountered: