{"id":14969122,"url":"https://github.com/fastify/fastify-routes-stats","last_synced_at":"2025-04-05T10:07:14.009Z","repository":{"id":30958807,"uuid":"126499946","full_name":"fastify/fastify-routes-stats","owner":"fastify","description":"provide stats for routes using perf_hooks, for fastify","archived":false,"fork":false,"pushed_at":"2025-03-07T19:12:49.000Z","size":130,"stargazers_count":50,"open_issues_count":0,"forks_count":12,"subscribers_count":16,"default_branch":"main","last_synced_at":"2025-03-29T09:08:24.090Z","etag":null,"topics":["fastify","fastify-plugin"],"latest_commit_sha":null,"homepage":"https://npmjs.com/package/@fastify/routes-stats","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fastify.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"fastify","open_collective":"fastify"}},"created_at":"2018-03-23T14:54:57.000Z","updated_at":"2025-03-07T19:11:53.000Z","dependencies_parsed_at":"2023-01-14T18:02:31.602Z","dependency_job_id":"76f02467-1241-4364-a228-7156c897b2d9","html_url":"https://github.com/fastify/fastify-routes-stats","commit_stats":{"total_commits":124,"total_committers":22,"mean_commits":5.636363636363637,"dds":0.6129032258064516,"last_synced_commit":"70d6451627e9c3b0966bd911956a985a020c2ec7"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fastify%2Ffastify-routes-stats","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fastify%2Ffastify-routes-stats/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fastify%2Ffastify-routes-stats/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fastify%2Ffastify-routes-stats/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fastify","download_url":"https://codeload.github.com/fastify/fastify-routes-stats/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247318744,"owners_count":20919484,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["fastify","fastify-plugin"],"created_at":"2024-09-24T13:41:10.405Z","updated_at":"2025-04-05T10:07:13.968Z","avatar_url":"https://github.com/fastify.png","language":"JavaScript","funding_links":["https://github.com/sponsors/fastify","https://opencollective.com/fastify"],"categories":[],"sub_categories":[],"readme":"# @fastify/routes-stats\n\n[![CI](https://github.com/fastify/fastify-routes-stats/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/fastify/fastify-routes-stats/actions/workflows/ci.yml)\n[![NPM version](https://img.shields.io/npm/v/@fastify/routes-stats.svg?style=flat)](https://www.npmjs.com/package/@fastify/routes-stats)\n[![neostandard javascript style](https://img.shields.io/badge/code_style-neostandard-brightgreen?style=flat)](https://github.com/neostandard/neostandard)\n\nProvide stats for routes using `require('node:perf_hooks')`, for **Fastify**.\n\n## Install\n\n```sh\nnpm i @fastify/routes-stats\n```\n\n## Example\n\n```js\n'use strict'\n\nconst Fastify = require('fastify')\nconst fastify = Fastify()\n\nfastify.register(require('@fastify/routes-stats'), {\n  printInterval: 4000, // milliseconds\n  decoratorName: \"performanceMarked\", // decorator is set to true if a performance.mark was called for the request\n})\n\nfastify.get('/', function (request, reply) {\n  reply.send({ hello: 'world' })\n})\n\nfastify.get(\n  '/:param/dynamic-route-example',\n  { config: { statsId: 'group-stats-together' } },\n  function (request, reply) {\n    reply.send({ hello: 'world' })\n  }\n)\n\nfastify.get('/__stats__', async function () {\n  // stats is added to the fastify instance\n  return this.stats()\n})\n\nfastify.listen({ port: 3000 })\n```\n\n```sh\n$ curl -s localhost:3000/__stats__ | jsonlint\n{\n  \"GET\": {\n    \"/\": {\n      \"mean\": 0.2406786,\n      \"mode\": 0.755647,\n      \"median\": 0.121999,\n      \"max\": 0.755647,\n      \"min\": 0.050214,\n      \"sd\": 0.2905856386253457\n    }\n  },\n  \"POST\": {\n    \"/\": {\n      \"mean\": 0.11260519999999999,\n      \"mode\": 0.292262,\n      \"median\": 0.055179,\n      \"max\": 0.292262,\n      \"min\": 0.044159,\n      \"sd\": 0.10438752062722824\n    }\n  }\n}\n```\n\nIt will also log a stat object every 30 seconds (by default).\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffastify%2Ffastify-routes-stats","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffastify%2Ffastify-routes-stats","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffastify%2Ffastify-routes-stats/lists"}