{"id":29165689,"url":"https://github.com/rhaymo/fastify-opencensus","last_synced_at":"2026-04-24T12:03:45.719Z","repository":{"id":35124285,"uuid":"209332073","full_name":"rhaymo/fastify-opencensus","owner":"rhaymo","description":"Fastify metrics and tracing using Opencensus","archived":false,"fork":false,"pushed_at":"2024-09-06T07:19:55.000Z","size":956,"stargazers_count":0,"open_issues_count":15,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-09-06T04:40:00.054Z","etag":null,"topics":["fastify","metrics","opencensus"],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","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/rhaymo.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","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}},"created_at":"2019-09-18T14:40:50.000Z","updated_at":"2020-12-22T15:17:38.000Z","dependencies_parsed_at":"2024-11-19T17:48:52.942Z","dependency_job_id":"af23468c-947a-431d-aa22-20c192f104bd","html_url":"https://github.com/rhaymo/fastify-opencensus","commit_stats":{"total_commits":23,"total_committers":2,"mean_commits":11.5,"dds":"0.34782608695652173","last_synced_commit":"bc71aae952fb5f117862e2c7b15d88dac1088098"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/rhaymo/fastify-opencensus","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rhaymo%2Ffastify-opencensus","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rhaymo%2Ffastify-opencensus/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rhaymo%2Ffastify-opencensus/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rhaymo%2Ffastify-opencensus/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rhaymo","download_url":"https://codeload.github.com/rhaymo/fastify-opencensus/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rhaymo%2Ffastify-opencensus/sbom","scorecard":{"id":774090,"data":{"date":"2025-08-18","repo":{"name":"github.com/rhaymo/fastify-opencensus","commit":"bc71aae952fb5f117862e2c7b15d88dac1088098"},"scorecard":{"version":"v5.2.1-41-g40576783","commit":"40576783fda6698350fcbbeaea760ff827433034"},"score":1.7,"checks":[{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#packaging"}},{"name":"Code-Review","score":0,"reason":"Found 0/14 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#code-review"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#token-permissions"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#binary-artifacts"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#maintained"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#dangerous-workflow"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#security-policy"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#license"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#fuzzing"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 16 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":0,"reason":"56 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-968p-4wvh-cqc8","Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92","Warn: Project is vulnerable to: GHSA-v88g-cgmw-v5xw","Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg","Warn: Project is vulnerable to: GHSA-pxg6-pf52-xh8x","Warn: Project is vulnerable to: GHSA-h452-7996-h45h","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-gxpj-cx7g-858c","Warn: Project is vulnerable to: GHSA-w573-4hg7-7wgq","Warn: Project is vulnerable to: GHSA-ff7x-qrg7-qggm","Warn: Project is vulnerable to: GHSA-fjxv-7rqg-78g4","Warn: Project is vulnerable to: GHSA-8r6j-v8pm-fqw3","Warn: Project is vulnerable to: MAL-2023-462","Warn: Project is vulnerable to: GHSA-ww39-953v-wcq6","Warn: Project is vulnerable to: GHSA-765h-qjxv-5f44","Warn: Project is vulnerable to: GHSA-f2jv-r9rf-7988","Warn: Project is vulnerable to: GHSA-7wwv-vh3v-89cq","Warn: Project is vulnerable to: GHSA-43f8-2h32-f4cj","Warn: Project is vulnerable to: GHSA-896r-f27r-55mw","Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h","Warn: Project is vulnerable to: GHSA-6c8f-qphg-qjgp","Warn: Project is vulnerable to: GHSA-29mw-wpgm-hmr9","Warn: Project is vulnerable to: GHSA-35jh-r3h4-6jhm","Warn: Project is vulnerable to: GHSA-xf5p-87ch-gxw2","Warn: Project is vulnerable to: GHSA-ch52-vgq2-943f","Warn: Project is vulnerable to: GHSA-5v2h-r2cx-5xgj","Warn: Project is vulnerable to: GHSA-rrrm-qjm4-v8hf","Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv","Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3","Warn: Project is vulnerable to: GHSA-vh95-rmgr-6w4m","Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h","Warn: Project is vulnerable to: GHSA-5fw9-fq32-wv5p","Warn: Project is vulnerable to: GHSA-hj48-42vr-x3v9","Warn: Project is vulnerable to: GHSA-9wv6-86v2-598j","Warn: Project is vulnerable to: GHSA-hrpp-h998-j3pp","Warn: Project is vulnerable to: GHSA-p8p7-x288-28g6","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: GHSA-4rq4-32rv-6wp6","Warn: Project is vulnerable to: GHSA-64g7-mvw6-v9qj","Warn: Project is vulnerable to: GHSA-3jfq-g458-7qm9","Warn: Project is vulnerable to: GHSA-r628-mhmh-qjhw","Warn: Project is vulnerable to: GHSA-9r2w-394v-53qc","Warn: Project is vulnerable to: GHSA-5955-9wpr-37jh","Warn: Project is vulnerable to: GHSA-qq89-hq3f-393p","Warn: Project is vulnerable to: GHSA-f5x3-32g6-xq36","Warn: Project is vulnerable to: GHSA-52f5-9888-hmc6","Warn: Project is vulnerable to: GHSA-jgrx-mgxx-jf9v","Warn: Project is vulnerable to: GHSA-72xf-g2v4-qvf3","Warn: Project is vulnerable to: GHSA-7p7h-4mm5-852v","Warn: Project is vulnerable to: GHSA-38fc-wpqx-33j7","Warn: Project is vulnerable to: GHSA-6fc8-4gx4-v693","Warn: Project is vulnerable to: GHSA-3h5v-q93c-6h6q","Warn: Project is vulnerable to: GHSA-c4w7-xm78-47vh","Warn: Project is vulnerable to: GHSA-p9pc-299p-vxgp"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-23T03:04:05.561Z","repository_id":35124285,"created_at":"2025-08-23T03:04:05.562Z","updated_at":"2025-08-23T03:04:05.562Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32222483,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-24T10:26:35.452Z","status":"ssl_error","status_checked_at":"2026-04-24T10:25:27.643Z","response_time":64,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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","metrics","opencensus"],"created_at":"2025-07-01T08:01:20.951Z","updated_at":"2026-04-24T12:03:45.713Z","avatar_url":"https://github.com/rhaymo.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# fastify-opencensus\n\n[![Node version](https://img.shields.io/node/v/fastify-opencensus)]()\n[![Downloads Count](https://img.shields.io/npm/dm/fastify-opencensus)]()\n[![Build Status](https://travis-ci.org/rhaymo/fastify-opencensus.svg?branch=master)](https://travis-ci.org/rhaymo/fastify-opencensus)\n[![Known Vulnerabilities](https://snyk.io//test/github/rhaymo/fastify-opencensus/badge.svg?targetFile=package.json)](https://snyk.io//test/github/rhaymo/fastify-opencensus?targetFile=package.json)\n[![Coverage Status](https://coveralls.io/repos/github/rhaymo/fastify-opencensus/badge.svg?branch=master)](https://coveralls.io/github/rhaymo/fastify-opencensus?branch=master)\n[![License](https://img.shields.io/github/license/rhaymo/fastify-opencensus)](https://github.com/rhaymo/fastify-opencensus/blob/master/LICENSE)\n\nMetrics collector for Fastify based on [Opencensus](https://opencensus.io/) .\n\nThis module is inspired and based on the [fastify-metrics](https://gitlab.com/m03geek/fastify-metrics) plugin.\n\nThis plugin adds 3 http metrics for your routes:\n\n- Requests duration distribution\n- Requests duration summary\n- Requests count\n\n## ToC\n\n- [fastify-opencensus](#fastify-opencensus)\n  - [ToC](#ToC)\n  - [Fastify support](#Fastify-support)\n  - [Installation](#Installation)\n  - [Features and requirements](#Features-and-requirements)\n  - [Usage](#Usage)\n    - [Plugin options](#Plugin-options)\n      - [Metrics details](#Metrics-details)\n    - [HTTP routes metrics](#HTTP-routes-metrics)\n  - [Docs](#Docs)\n  - [Changelog](#Changelog)\n  - [See also](#See-also)\n  - [License](#License)\n\n## Fastify support\n\n- **v0.x.x** - will support `\u003e= fastify-2.0.0`\n\n## Installation\n\n```sh\nnpm i fastify-opencensus --save\n```\n\n\u003csub\u003e[Back to top](#toc)\u003c/sub\u003e\n\n## Features and requirements\n\n- Collects default server metrics (see [opencensus-default-metrics](https://github.com/rhaymo/opencensus-node-default-metrics));\n- Collects route response timings\n- By default, metrics info are collected into the global instance of opencensus required by this package. If you want to use another opencensus version, you have to pass in this instance using the `stats` options field.\n\n---\n\n- Requires fastify `\u003e=2.0.0`.\n- Node.js `\u003e=8.9.0`.\n\n\u003csub\u003e[Back to top](#toc)\u003c/sub\u003e\n\n## Usage\n\nAdd it to your project like regular fastify plugin. Use `register` method and pass options to it.\n\n```js\nconst fastify = require('fastify');\nconst app = fastify();\n\nconst metricsPlugin = require('fastify-opencensus');\napp.register(metricsPlugin, { interval: 3000 });\n```\n\nIt also exports opencensus stats instance to fastify instance `fastify.opencensus.client` which you may use it in your routes.\n\nSee example folder for other examples.\n\n\u003csub\u003e[Back to top](#toc)\u003c/sub\u003e\n\n### Plugin options\n\n| parameter              | type                     | description                                                                     | default      |\n| ---------------------- | ------------------------ | ------------------------------------------------------------------------------- | ------------ |\n| `enableDefaultMetrics` | Boolean                  | Enables collection of node default metrics.                                     | `true`       |\n| `enableStats`          | Boolean                  | Enables collection of fastify metrics.                                          | `true`       |\n| `stats`                | Object                   | Custom opencensus metrics instance.                                             | `undefined`  |\n| `metricsExporter`      | Array\u003cObject\u003e            | Array of Opencensus metrics exporter                                            | `undefined`  |\n| `groupStatusCodes`     | Boolean                  | Groups status codes (e.g. 2XX) if `true`                                        | `false`      |\n| `pluginName`           | String                   | Change name which you'll use to access opencensus registry instance in fastify. | `opencensus` |\n| `interval`             | Number                   | Default metrics collection interval in ms.                                      | `5000`       |\n| `blacklist`            | String, RegExp, String[] | Skip metrics collection for blacklisted routes                                  | `undefined`  |\n| `prefix`               | String                   | Custom default metrics prefix.                                                  | `\"\"`         |\n| `metrics`              | Object                   | Allows override default metrics config. See section below.                      | `{}`         |\n\n#### Metrics details\n\nYou may override default metrics settings. You may provide overrides for three metrics tracking http request durations, count and sum (labelNames cannot be overriden).\nDefault values:\n\n```js\n{\n  distribution: {\n    name: 'http_request_duration_seconds',\n    desc: 'request duration in seconds',\n    labelNames: ['status_code', 'method', 'route'],\n    buckets: [0.05, 0.1, 0.5, 1, 3, 5, 10],\n  },\n  sum: {\n    name: 'http_sum_request_duration_seconds',\n    desc: 'Sum of durations of http requests',\n    labelNames: ['status_code', 'method', 'route']\n  },\n  count: {\n    name: 'http_request_count',\n    desc: 'Counter of http requests',\n    labelNames: ['status_code', 'method', 'route']\n  },\n}\n```\n\nOverride should look like:\n\n```js\nconst fastify = require('fastify');\nconst app = fastify();\nconst metricsPlugin = require('fastify-metrics');\n\napp.register(metricsPlugin, {metrics: {\n  distribution: {\n    name: 'my_custom_http_request_duration_seconds',\n    buckets: [0.1, 0.5, 1, 3, 5],\n  },\n  sum: {\n    desc: 'custom request duration in seconds summary help'\n  },\n});\n```\n\n\u003csub\u003e[Back to top](#toc)\u003c/sub\u003e\n\n### HTTP routes metrics\n\nThe following table shows what metrics will be available in Prometheus. Note suffixes like `_bucket`, `_sum`, `_count` are added automatically.\n\n| metric                              | labels                           | description                  |\n| ----------------------------------- | -------------------------------- | ---------------------------- |\n| `http_request_count`                | `method`, `route`, `status_code` | Requests total count         |\n| `http_request_duration_seconds`     | `method`, `route`, `status_code` | Requests durations by bucket |\n| `http_sum_request_duration_seconds` | `method`, `route`, `status_code` | Requests duration sum        |\n\n\u003csub\u003e[Back to top](#toc)\u003c/sub\u003e\n\n## Docs\n\nSee [docs](docs/README.md).\n\n\u003csub\u003e[Back to top](#toc)\u003c/sub\u003e\n\n## Changelog\n\nSee [changelog](CHANGELOG.md).\n\n\u003csub\u003e[Back to top](#toc)\u003c/sub\u003e\n\n## See also\n\n- [opencensus-default-metrics](https://github.com/rhaymo/opencensus-node-default-metrics) - collector of node default metrics using opencensus\n\n\u003csub\u003e[Back to top](#toc)\u003c/sub\u003e\n\n## License\n\nLicensed under [MIT](./LICENSE).\n\n\u003csub\u003e[Back to top](#toc)\u003c/sub\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frhaymo%2Ffastify-opencensus","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frhaymo%2Ffastify-opencensus","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frhaymo%2Ffastify-opencensus/lists"}