Closed flowjo-isaach closed 1 year ago
It doesn't exist: this plugin shows what comes in the server and does not count the time each resolver takes.
This plugin's scope is to understand:
so you can drop API or support your customer better and proactively.
For time tracking I suggest:
reqId
: you have already multiple log lines for a single request. Merging the logline from this plugin and the default fastify response log with the reqId
, you can get the total request timeJust want to add perhaps a simpler approach,
You can utilize the logMessage
function and Fastifys built-in elapsedTime
like so:
fastify.register(mercuriusLogging, {
logMessage: function (context) {
return `RequestDuration: ${context.reply.elapsedTime}`;
}
});
Unfortunately it'll put the duration under the message
key in the request, but is great for its simplicity 👍
I'm hoping to display the response time for resolved fields and the requests from graphQL. I don't see this information in this module. Is there a configuration I'm missing or does it not exist?