fastify-server-timing
TypeScript icon, indicating that this package has built-in type declarations

1.0.3 • Public • Published

fastify-server-timing

Server-Timing API for fastify.

License Latest Release Node Version Fastify Version Publish Size Typescript Sponsor

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.

Installation

npm install fastify-server-timing

Usage

Register the plugin and if needed pass to it some custom options.

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 {}
})

Sponsors

Kenoxa GmbH Kenoxa GmbH

Support

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.

Contribute

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.

Develop

  • npm test: Run test suite
  • npm run build: Generate bundles
  • npm run lint: Lints code

NPM Statistics

NPM

License

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

/fastify-server-timing/

    Package Sidebar

    Install

    npm i fastify-server-timing

    Weekly Downloads

    76

    Version

    1.0.3

    License

    MIT

    Unpacked Size

    29.8 kB

    Total Files

    13

    Last publish

    Collaborators

    • sastan