> Server-Timing API for fastify.
npm install fastify-server-timing> Server-Timing API for fastify.


!Node Version


!Typescript

Expose Server-Timing to communicate one or more metrics and descriptions for a given request-response cycle. It is used to surface any backend server timing metrics (e.g. database read/write, CPU time, file system access, etc.) in the developer tools in the user's browser or in the PerformanceServerTiming interface.
``sh`
npm install fastify-server-timing
Register the plugin and if needed pass to it some custom options.
`js
const fastify = require('fastify')()
// using the defaults
fastify.register(require('fastify-server-timing'))
// with custom options
fastify.register(require('fastify-server-timing'), { / ... Options ... / })
// use reply.addServerTiming to report a metric
fastify.get('/', (request, reply) => {
reply.addServerTiming('cache', 23.2, 'Cache Read')
return {}
})
`
- Options
- reply.addServerTiming(name: string, duration?: undefined \| number, description?: undefined \| string): void
 Kenoxa GmbH
This project is free and open-source, so if you think this project can help you or anyone else, you may star it on GitHub. Feel free to open an issue if you have any idea, question, or you've found a bug.
Thanks for being willing to contribute!
Working on your first Pull Request? You can learn how from this _free_ series How to Contribute to an Open Source Project on GitHub
We are following the Conventional Commits convention.
- npm test: Run test suitenpm run build
- : Generate bundlesnpm run lint
- : Lints code

fastify-server-timing` is open source software licensed as MIT.