├── .circleci └── config.yml ├── .editorconfig ├── .gitattributes ├── .gitignore ├── LICENSE.md ├── README.md ├── code_of_conduct.md ├── config ├── functions │ └── bootstrap.js └── routes.json ├── middlewares └── prom │ ├── config.json │ └── index.js ├── package-lock.json └── package.json /.circleci/config.yml: -------------------------------------------------------------------------------- 1 | version: 2.1 2 | 3 | defaults: &defaults 4 | working_directory: ~/repo 5 | docker: 6 | - image: circleci/node:8-jessie 7 | jobs: 8 | test: 9 | <<: *defaults 10 | steps: 11 | - checkout 12 | 13 | - restore_cache: 14 | keys: 15 | - v1-dependencies-{{ checksum "package.json" }} 16 | # fallback to using the latest cache if no exact match is found 17 | - v1-dependencies- 18 | - run: sudo apt-get update 19 | - run: 20 | name: Install 21 | command: npm install 22 | - run: echo "no tests yet" 23 | 24 | - save_cache: 25 | paths: 26 | - node_modules 27 | key: v1-dependencies-{{ checksum "package.json" }} 28 | - persist_to_workspace: 29 | root: ~/repo 30 | paths: . 31 | 32 | deploy: 33 | <<: *defaults 34 | steps: 35 | - attach_workspace: 36 | at: ~/repo 37 | - run: 38 | name: Authenticate with registry 39 | command: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > ~/repo/.npmrc 40 | - run: 41 | name: Publish package 42 | command: npm publish 43 | 44 | workflows: 45 | version: 2 46 | test-deploy: 47 | jobs: 48 | - test: 49 | filters: 50 | tags: 51 | only: /^v.*/ 52 | - deploy: 53 | requires: 54 | - test 55 | filters: 56 | tags: 57 | only: /^v.*/ 58 | branches: 59 | ignore: /.*/ -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | end_of_line = lf 5 | insert_final_newline = false 6 | indent_style = space 7 | indent_size = 2 -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # From https://github.com/Danimoth/gitattributes/blob/master/Web.gitattributes 2 | 3 | # Handle line endings automatically for files detected as text 4 | # and leave all files detected as binary untouched. 5 | * text=auto 6 | 7 | # 8 | # The above will handle all files NOT found below 9 | # 10 | 11 | # 12 | ## These files are text and should be normalized (Convert crlf => lf) 13 | # 14 | 15 | # source code 16 | *.php text 17 | *.css text 18 | *.sass text 19 | *.scss text 20 | *.less text 21 | *.styl text 22 | *.js text eol=lf 23 | *.coffee text 24 | *.json text 25 | *.htm text 26 | *.html text 27 | *.xml text 28 | *.svg text 29 | *.txt text 30 | *.ini text 31 | *.inc text 32 | *.pl text 33 | *.rb text 34 | *.py text 35 | *.scm text 36 | *.sql text 37 | *.sh text 38 | *.bat text 39 | 40 | # templates 41 | *.ejs text 42 | *.hbt text 43 | *.jade text 44 | *.haml text 45 | *.hbs text 46 | *.dot text 47 | *.tmpl text 48 | *.phtml text 49 | 50 | # git config 51 | .gitattributes text 52 | .gitignore text 53 | .gitconfig text 54 | 55 | # code analysis config 56 | .jshintrc text 57 | .jscsrc text 58 | .jshintignore text 59 | .csslintrc text 60 | 61 | # misc config 62 | *.yaml text 63 | *.yml text 64 | .editorconfig text 65 | 66 | # build config 67 | *.npmignore text 68 | *.bowerrc text 69 | 70 | # Heroku 71 | Procfile text 72 | .slugignore text 73 | 74 | # Documentation 75 | *.md text 76 | LICENSE text 77 | AUTHORS text 78 | 79 | 80 | # 81 | ## These files are binary and should be left untouched 82 | # 83 | 84 | # (binary is a macro for -text -diff) 85 | *.png binary 86 | *.jpg binary 87 | *.jpeg binary 88 | *.gif binary 89 | *.ico binary 90 | *.mov binary 91 | *.mp4 binary 92 | *.mp3 binary 93 | *.flv binary 94 | *.fla binary 95 | *.swf binary 96 | *.gz binary 97 | *.zip binary 98 | *.7z binary 99 | *.ttf binary 100 | *.eot binary 101 | *.woff binary 102 | *.pyc binary 103 | *.pdf binary 104 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Don't check auto-generated stuff into git 2 | coverage 3 | node_modules 4 | stats.json 5 | package-lock.json 6 | 7 | # Cruft 8 | .DS_Store 9 | npm-debug.log 10 | .idea 11 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | Copyright 2020, strapi-plugin-prometheus-metrics developers 2 | 3 | Hippocratic License Version 2.0. 4 | 5 | Licensor hereby grants permission by this license ("License"), free of charge, to any person or entity (the "Licensee") obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 6 | 7 | 8 | * The above copyright notice and this License or a subsequent version published on the Hippocratic License Website (https://firstdonoharm.dev/) shall be included in all copies or substantial portions of the Software. Licensee has the option of following the terms and conditions either of the above numbered version of this License or of any subsequent version published on the Hippocratic License Website. 9 | 10 | * Compliance with Human Rights Laws and Human Rights Principles: 11 | 12 | 1. Human Rights Laws. The Software shall not be used by any person or entity for any systems, activities, or other uses that violate any applicable laws, regulations, or rules that protect human, civil, labor, privacy, political, environmental, security, economic, due process, or similar rights (the "Human Rights Laws"). Where the Human Rights Laws of more than one jurisdiction are applicable to the use of the Software, the Human Rights Laws that are most protective of the individuals or groups harmed shall apply. 13 | 14 | 2. Human Rights Principles. Licensee is advised to consult the articles of the United Nations Universal Declaration of Human Rights (https://www.un.org/en/universal-declaration-human-rights/) and the United Nations Global Compact (https://www.unglobalcompact.org/what-is-gc/mission/principles) that define recognized principles of international human rights (the "Human Rights Principles"). It is Licensor's express intent that all use of the Software be consistent with Human Rights Principles. If Licensor receives notification or otherwise learns of an alleged violation of any Human Rights Principles relating to Licensee's use of the Software, Licensor may in its discretion and without obligation (i) (a) notify Licensee of such allegation and (b) allow Licensee 90 days from notification under (i)(a) to investigate and respond to Licensor regarding the allegation and (ii) (a) after the earlier of 90 days from notification under (i)(a), or Licensee's response under (i)(b), notify Licensee of License termination and (b) allow Licensee an additional 90 days from notification under (ii)(a) to cease use of the Software. 15 | 16 | 3. Indemnity. Licensee shall hold harmless and indemnify Licensor against all losses, damages, liabilities, deficiencies, claims, actions, judgments, settlements, interest, awards, penalties, fines, costs, or expenses of whatever kind, including Licensor's reasonable attorneys' fees, arising out of or relating to Licensee's non-compliance with this License or use of the Software in violation of Human Rights Laws or Human Rights Principles.  17 | 18 | * Enforceability: If any portion or provision of this License is determined to be invalid, illegal, or unenforceable by a court of competent jurisdiction, then such invalidity, illegality, or unenforceability shall not affect any other term or provision of this License or invalidate or render unenforceable such term or provision in any other jurisdiction. Upon a determination that any term or provision is invalid, illegal, or unenforceable, to the extent permitted by applicable law, the court may modify this License to affect the original intent of the parties as closely as possible. The section headings are for convenience only and are not intended to affect the construction or interpretation of this License. Any rule of construction to the effect that ambiguities are to be resolved against the drafting party shall not apply in interpreting this License. The language in this License shall be interpreted as to its fair meaning and not strictly for or against any party. 19 | 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | 23 | This Hippocratic License is an Ethical Source license (https://ethicalsource.dev). 24 | 25 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # strapi-plugin-prometheus-metrics 2 | 3 | [![CircleCI](https://circleci.com/gh/wirehead/strapi-plugin-prometheus-metrics.svg?style=shield)](https://circleci.com/gh/wirehead/strapi-plugin-prometheus-metrics)[![npm version](https://badge.fury.io/js/strapi-plugin-prometheus-metrics.svg)](https://www.npmjs.com/package/strapi-plugin-prometheus-metrics)[![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-v2.0%20adopted-ff69b4.svg)](code_of_conduct.md)[![Contributor Covenant](https://img.shields.io/badge/license-Hippocratic%20OSL%202.0-4baaaa)](https://firstdonoharm.dev/) 4 | 5 | Adds Prometheus metrics to a [Strapi](http://strapi.io/) instance using [prometheus-api-metrics](https://github.com/Zooz/prometheus-api-metrics). 6 | 7 | Alternatively, it's a good extremely-simple example of how to add koa functionality to strapi. 8 | 9 | ## Release status 10 | 11 | It's probably usable at this point. 12 | 13 | ## Installation 14 | 15 | Use the package manager [npm](https://https://www.npmjs.com/) to install. 16 | 17 | ```bash 18 | npm i strapi-plugin-prometheus-metrics 19 | ``` 20 | 21 | ## Usage 22 | 23 | You need to set the `settings.prom.enabled` key to true and also set a metrics path in `settings.prom.metricsPath`. 24 | 25 | If your `config/middleware.js` looks something like this: 26 | 27 | ```javascript 28 | module.exports = { 29 | settings: { 30 | }, 31 | }; 32 | ```` 33 | 34 | You would want to add 35 | 36 | ```javascript 37 | module.exports = { 38 | settings: { 39 | "prom": { 40 | "enabled": true, 41 | "metricsPath": "/metrics", 42 | }, 43 | }, 44 | }; 45 | ``` 46 | 47 | 48 | ## Configuration: 49 | 50 | If your `config/middleware.js` you can configure keys like this: 51 | 52 | ```javascript 53 | module.exports = { 54 | settings: { 55 | "prom": { 56 | "enabled": true, 57 | "metricsPath": "/metrics", 58 | "metricsPrefix": "foo" 59 | }, 60 | }, 61 | }; 62 | ``` 63 | 64 | Keys you can set are: 65 | 66 | * `metricsPath` - The URL path the metrics are accessible under. The default is `/metrics` 67 | * `defaultMetricsInterval` - The interval that metrics are collected over. The default is `10000` 68 | * `durationBuckets` - An array of buckets that the response time is bucketed over, in seconds. The default is `[0.001, 0.005, 0.015, 0.05, 0.1, 0.2, 0.3, 0.4, 0.5]` 69 | * `requestSizeBuckets` - An array of buckets that the request size is bucketed over, in bytes. The default is `[5, 10, 25, 50, 100, 250, 500, 1000, 2500, 5000, 10000]` 70 | * `responseSizeBuckets` - An array of buckets that the response size is bucketed over, in bytes. The default is `[5, 10, 25, 50, 100, 250, 500, 1000, 2500, 5000, 10000]` 71 | * `useUniqueHistogramName` - Set this key to use the project name (from the `package.json` file) as a prefix. 72 | * `metricsPrefix` - Set this key to set a string that will be added with an undescore before the metrics name. 73 | * `excludeRoutes` - Set this key to exclude routes from collection. 74 | * `includeQueryParams` - A boolean that indicate if to include query params in route, the query parameters will be sorted in order to eliminate the number of unique labels. 75 | 76 | ## A few security concerns to think about 77 | 78 | Generally, you want to be running strapi with some sort of front-end process (say Apache HTTPD or nginx), just as a matter of good practice. If you expose the `/metrics` endpoint to the world, it might leak some amount of information to an attacker. 79 | 80 | Also, if you aren't careful with the includeQueryParams feature, it might leak more information than you intended. 81 | 82 | ## Contributing 83 | 84 | Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change. 85 | 86 | ## Code of conduct 87 | 88 | Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms. 89 | 90 | ## License 91 | 92 | [Hippocratic Open Source License 2.0](https://firstdonoharm.dev/) see LICENSE.md -------------------------------------------------------------------------------- /code_of_conduct.md: -------------------------------------------------------------------------------- 1 | 2 | # Contributor Covenant Code of Conduct 3 | 4 | ## Our Pledge 5 | 6 | We as members, contributors, and leaders pledge to make participation in our 7 | community a harassment-free experience for everyone, regardless of age, body 8 | size, visible or invisible disability, ethnicity, sex characteristics, gender 9 | identity and expression, level of experience, education, socio-economic status, 10 | nationality, personal appearance, race, religion, or sexual identity 11 | and orientation. 12 | 13 | We pledge to act and interact in ways that contribute to an open, welcoming, 14 | diverse, inclusive, and healthy community. 15 | 16 | ## Our Standards 17 | 18 | Examples of behavior that contributes to a positive environment for our 19 | community include: 20 | 21 | * Demonstrating empathy and kindness toward other people 22 | * Being respectful of differing opinions, viewpoints, and experiences 23 | * Giving and gracefully accepting constructive feedback 24 | * Accepting responsibility and apologizing to those affected by our mistakes, 25 | and learning from the experience 26 | * Focusing on what is best not just for us as individuals, but for the 27 | overall community 28 | 29 | Examples of unacceptable behavior include: 30 | 31 | * The use of sexualized language or imagery, and sexual attention or 32 | advances of any kind 33 | * Trolling, insulting or derogatory comments, and personal or political attacks 34 | * Public or private harassment 35 | * Publishing others' private information, such as a physical or email 36 | address, without their explicit permission 37 | * Other conduct which could reasonably be considered inappropriate in a 38 | professional setting 39 | 40 | ## Enforcement Responsibilities 41 | 42 | Community leaders are responsible for clarifying and enforcing our standards of 43 | acceptable behavior and will take appropriate and fair corrective action in 44 | response to any behavior that they deem inappropriate, threatening, offensive, 45 | or harmful. 46 | 47 | Community leaders have the right and responsibility to remove, edit, or reject 48 | comments, commits, code, wiki edits, issues, and other contributions that are 49 | not aligned to this Code of Conduct, and will communicate reasons for moderation 50 | decisions when appropriate. 51 | 52 | ## Scope 53 | 54 | This Code of Conduct applies within all community spaces, and also applies when 55 | an individual is officially representing the community in public spaces. 56 | Examples of representing our community include using an official e-mail address, 57 | posting via an official social media account, or acting as an appointed 58 | representative at an online or offline event. 59 | 60 | ## Enforcement 61 | 62 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 63 | reported to the community leaders responsible for enforcement at 64 | wh-coc@wirewd.com. 65 | All complaints will be reviewed and investigated promptly and fairly. 66 | 67 | All community leaders are obligated to respect the privacy and security of the 68 | reporter of any incident. 69 | 70 | ## Enforcement Guidelines 71 | 72 | Community leaders will follow these Community Impact Guidelines in determining 73 | the consequences for any action they deem in violation of this Code of Conduct: 74 | 75 | ### 1. Correction 76 | 77 | **Community Impact**: Use of inappropriate language or other behavior deemed 78 | unprofessional or unwelcome in the community. 79 | 80 | **Consequence**: A private, written warning from community leaders, providing 81 | clarity around the nature of the violation and an explanation of why the 82 | behavior was inappropriate. A public apology may be requested. 83 | 84 | ### 2. Warning 85 | 86 | **Community Impact**: A violation through a single incident or series 87 | of actions. 88 | 89 | **Consequence**: A warning with consequences for continued behavior. No 90 | interaction with the people involved, including unsolicited interaction with 91 | those enforcing the Code of Conduct, for a specified period of time. This 92 | includes avoiding interactions in community spaces as well as external channels 93 | like social media. Violating these terms may lead to a temporary or 94 | permanent ban. 95 | 96 | ### 3. Temporary Ban 97 | 98 | **Community Impact**: A serious violation of community standards, including 99 | sustained inappropriate behavior. 100 | 101 | **Consequence**: A temporary ban from any sort of interaction or public 102 | communication with the community for a specified period of time. No public or 103 | private interaction with the people involved, including unsolicited interaction 104 | with those enforcing the Code of Conduct, is allowed during this period. 105 | Violating these terms may lead to a permanent ban. 106 | 107 | ### 4. Permanent Ban 108 | 109 | **Community Impact**: Demonstrating a pattern of violation of community 110 | standards, including sustained inappropriate behavior, harassment of an 111 | individual, or aggression toward or disparagement of classes of individuals. 112 | 113 | **Consequence**: A permanent ban from any sort of public interaction within 114 | the community. 115 | 116 | ## Attribution 117 | 118 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], 119 | version 2.0, available at 120 | https://www.contributor-covenant.org/version/2/0/code_of_conduct.html. 121 | 122 | Community Impact Guidelines were inspired by [Mozilla's code of conduct 123 | enforcement ladder](https://github.com/mozilla/diversity). 124 | 125 | [homepage]: https://www.contributor-covenant.org 126 | 127 | For answers to common questions about this code of conduct, see the FAQ at 128 | https://www.contributor-covenant.org/faq. Translations are available at 129 | https://www.contributor-covenant.org/translations. 130 | 131 | -------------------------------------------------------------------------------- /config/functions/bootstrap.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /** 4 | * An asynchronous bootstrap function that runs before 5 | * your application gets started. 6 | * 7 | * This gives you an opportunity to set up your data model, 8 | * run jobs, or perform some special logic. 9 | */ 10 | module.exports = async () => { 11 | // set plugin store 12 | const pluginStore = strapi.store({ 13 | environment: strapi.config.environment, 14 | type: 'plugin', 15 | name: 'prometheus-metrics', 16 | }); 17 | }; 18 | -------------------------------------------------------------------------------- /config/routes.json: -------------------------------------------------------------------------------- 1 | { 2 | "routes": [ 3 | 4 | ] 5 | } 6 | -------------------------------------------------------------------------------- /middlewares/prom/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "prom": { 3 | "enabled": true 4 | } 5 | } -------------------------------------------------------------------------------- /middlewares/prom/index.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const apiMetrics = require('prometheus-api-metrics').koaMiddleware; 4 | 5 | module.exports = strapi => { 6 | 7 | return { 8 | initialize: function(cb) { 9 | const promSettings = strapi.config.middleware.settings.prom; 10 | const metricsPath = promSettings.metricsPath; 11 | const defaultMetricsInterval = promSettings.defaultMetricsInterval; 12 | const durationBuckets = promSettings.durationBuckets; 13 | const requestSizeBuckets = promSettings.requestSizeBuckets; 14 | const responseSizeBuckets = promSettings.responseSizeBuckets; 15 | const useUniqueHistogramName = promSettings.useUniqueHistogramName; 16 | const metricsPrefix = promSettings.metricsPrefix; 17 | const excludeRoutes = promSettings.excludeRoutes; 18 | const includeQueryParams = promSettings.includeQueryParams; 19 | 20 | const wrapped = apiMetrics({ 21 | metricsPath, 22 | defaultMetricsInterval, 23 | durationBuckets, 24 | requestSizeBuckets, 25 | responseSizeBuckets, 26 | useUniqueHistogramName, 27 | metricsPrefix, 28 | excludeRoutes, 29 | includeQueryParams 30 | }); 31 | 32 | strapi.app.use((ctx, next) => { 33 | if (ctx.req.url === metricsPath) { 34 | return wrapped(ctx,next); 35 | } else if (ctx.req.url === `${metricsPath}.json`) { 36 | return wrapped(ctx,next); 37 | } else if ((ctx.response.status != 404)) { 38 | return wrapped(ctx,next); 39 | } else { 40 | return next(); 41 | } 42 | }); 43 | }, 44 | }; 45 | }; 46 | -------------------------------------------------------------------------------- /package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "strapi-plugin-prometheus-metrics", 3 | "version": "0.0.3", 4 | "lockfileVersion": 1, 5 | "requires": true, 6 | "dependencies": { 7 | "@types/accepts": { 8 | "version": "1.3.5", 9 | "resolved": "https://registry.npmjs.org/@types/accepts/-/accepts-1.3.5.tgz", 10 | "integrity": "sha512-jOdnI/3qTpHABjM5cx1Hc0sKsPoYCp+DP/GJRGtDlPd7fiV9oXGGIcjW/ZOxLIvjGz8MA+uMZI9metHlgqbgwQ==", 11 | "requires": { 12 | "@types/node": "*" 13 | } 14 | }, 15 | "@types/body-parser": { 16 | "version": "1.19.0", 17 | "resolved": "https://registry.npmjs.org/@types/body-parser/-/body-parser-1.19.0.tgz", 18 | "integrity": "sha512-W98JrE0j2K78swW4ukqMleo8R7h/pFETjM2DQ90MF6XK2i4LO4W3gQ71Lt4w3bfm2EvVSyWHplECvB5sK22yFQ==", 19 | "requires": { 20 | "@types/connect": "*", 21 | "@types/node": "*" 22 | } 23 | }, 24 | "@types/connect": { 25 | "version": "3.4.34", 26 | "resolved": "https://registry.npmjs.org/@types/connect/-/connect-3.4.34.tgz", 27 | "integrity": "sha512-ePPA/JuI+X0vb+gSWlPKOY0NdNAie/rPUqX2GUPpbZwiKTkSPhjXWuee47E4MtE54QVzGCQMQkAL6JhV2E1+cQ==", 28 | "requires": { 29 | "@types/node": "*" 30 | } 31 | }, 32 | "@types/content-disposition": { 33 | "version": "0.5.3", 34 | "resolved": "https://registry.npmjs.org/@types/content-disposition/-/content-disposition-0.5.3.tgz", 35 | "integrity": "sha512-P1bffQfhD3O4LW0ioENXUhZ9OIa0Zn+P7M+pWgkCKaT53wVLSq0mrKksCID/FGHpFhRSxRGhgrQmfhRuzwtKdg==" 36 | }, 37 | "@types/cookies": { 38 | "version": "0.7.6", 39 | "resolved": "https://registry.npmjs.org/@types/cookies/-/cookies-0.7.6.tgz", 40 | "integrity": "sha512-FK4U5Qyn7/Sc5ih233OuHO0qAkOpEcD/eG6584yEiLKizTFRny86qHLe/rej3HFQrkBuUjF4whFliAdODbVN/w==", 41 | "requires": { 42 | "@types/connect": "*", 43 | "@types/express": "*", 44 | "@types/keygrip": "*", 45 | "@types/node": "*" 46 | } 47 | }, 48 | "@types/express": { 49 | "version": "4.17.9", 50 | "resolved": "https://registry.npmjs.org/@types/express/-/express-4.17.9.tgz", 51 | "integrity": "sha512-SDzEIZInC4sivGIFY4Sz1GG6J9UObPwCInYJjko2jzOf/Imx/dlpume6Xxwj1ORL82tBbmN4cPDIDkLbWHk9hw==", 52 | "requires": { 53 | "@types/body-parser": "*", 54 | "@types/express-serve-static-core": "*", 55 | "@types/qs": "*", 56 | "@types/serve-static": "*" 57 | } 58 | }, 59 | "@types/express-serve-static-core": { 60 | "version": "4.17.17", 61 | "resolved": "https://registry.npmjs.org/@types/express-serve-static-core/-/express-serve-static-core-4.17.17.tgz", 62 | "integrity": "sha512-YYlVaCni5dnHc+bLZfY908IG1+x5xuibKZMGv8srKkvtul3wUuanYvpIj9GXXoWkQbaAdR+kgX46IETKUALWNQ==", 63 | "requires": { 64 | "@types/node": "*", 65 | "@types/qs": "*", 66 | "@types/range-parser": "*" 67 | } 68 | }, 69 | "@types/http-assert": { 70 | "version": "1.5.1", 71 | "resolved": "https://registry.npmjs.org/@types/http-assert/-/http-assert-1.5.1.tgz", 72 | "integrity": "sha512-PGAK759pxyfXE78NbKxyfRcWYA/KwW17X290cNev/qAsn9eQIxkH4shoNBafH37wewhDG/0p1cHPbK6+SzZjWQ==" 73 | }, 74 | "@types/http-errors": { 75 | "version": "1.8.0", 76 | "resolved": "https://registry.npmjs.org/@types/http-errors/-/http-errors-1.8.0.tgz", 77 | "integrity": "sha512-2aoSC4UUbHDj2uCsCxcG/vRMXey/m17bC7UwitVm5hn22nI8O8Y9iDpA76Orc+DWkQ4zZrOKEshCqR/jSuXAHA==" 78 | }, 79 | "@types/keygrip": { 80 | "version": "1.0.2", 81 | "resolved": "https://registry.npmjs.org/@types/keygrip/-/keygrip-1.0.2.tgz", 82 | "integrity": "sha512-GJhpTepz2udxGexqos8wgaBx4I/zWIDPh/KOGEwAqtuGDkOUJu5eFvwmdBX4AmB8Odsr+9pHCQqiAqDL/yKMKw==" 83 | }, 84 | "@types/koa": { 85 | "version": "2.11.6", 86 | "resolved": "https://registry.npmjs.org/@types/koa/-/koa-2.11.6.tgz", 87 | "integrity": "sha512-BhyrMj06eQkk04C97fovEDQMpLpd2IxCB4ecitaXwOKGq78Wi2tooaDOWOFGajPk8IkQOAtMppApgSVkYe1F/A==", 88 | "requires": { 89 | "@types/accepts": "*", 90 | "@types/content-disposition": "*", 91 | "@types/cookies": "*", 92 | "@types/http-assert": "*", 93 | "@types/http-errors": "*", 94 | "@types/keygrip": "*", 95 | "@types/koa-compose": "*", 96 | "@types/node": "*" 97 | } 98 | }, 99 | "@types/koa-compose": { 100 | "version": "3.2.5", 101 | "resolved": "https://registry.npmjs.org/@types/koa-compose/-/koa-compose-3.2.5.tgz", 102 | "integrity": "sha512-B8nG/OoE1ORZqCkBVsup/AKcvjdgoHnfi4pZMn5UwAPCbhk/96xyv284eBYW8JlQbQ7zDmnpFr68I/40mFoIBQ==", 103 | "requires": { 104 | "@types/koa": "*" 105 | } 106 | }, 107 | "@types/mime": { 108 | "version": "2.0.3", 109 | "resolved": "https://registry.npmjs.org/@types/mime/-/mime-2.0.3.tgz", 110 | "integrity": "sha512-Jus9s4CDbqwocc5pOAnh8ShfrnMcPHuJYzVcSUU7lrh8Ni5HuIqX3oilL86p3dlTrk0LzHRCgA/GQ7uNCw6l2Q==" 111 | }, 112 | "@types/node": { 113 | "version": "14.14.16", 114 | "resolved": "https://registry.npmjs.org/@types/node/-/node-14.14.16.tgz", 115 | "integrity": "sha512-naXYePhweTi+BMv11TgioE2/FXU4fSl29HAH1ffxVciNsH3rYXjNP2yM8wqmSm7jS20gM8TIklKiTen+1iVncw==" 116 | }, 117 | "@types/qs": { 118 | "version": "6.9.5", 119 | "resolved": "https://registry.npmjs.org/@types/qs/-/qs-6.9.5.tgz", 120 | "integrity": "sha512-/JHkVHtx/REVG0VVToGRGH2+23hsYLHdyG+GrvoUGlGAd0ErauXDyvHtRI/7H7mzLm+tBCKA7pfcpkQ1lf58iQ==" 121 | }, 122 | "@types/range-parser": { 123 | "version": "1.2.3", 124 | "resolved": "https://registry.npmjs.org/@types/range-parser/-/range-parser-1.2.3.tgz", 125 | "integrity": "sha512-ewFXqrQHlFsgc09MK5jP5iR7vumV/BYayNC6PgJO2LPe8vrnNFyjQjSppfEngITi0qvfKtzFvgKymGheFM9UOA==" 126 | }, 127 | "@types/serve-static": { 128 | "version": "1.13.8", 129 | "resolved": "https://registry.npmjs.org/@types/serve-static/-/serve-static-1.13.8.tgz", 130 | "integrity": "sha512-MoJhSQreaVoL+/hurAZzIm8wafFR6ajiTM1m4A0kv6AGeVBl4r4pOV8bGFrjjq1sGxDTnCoF8i22o0/aE5XCyA==", 131 | "requires": { 132 | "@types/mime": "*", 133 | "@types/node": "*" 134 | } 135 | }, 136 | "bintrees": { 137 | "version": "1.0.1", 138 | "resolved": "https://registry.npmjs.org/bintrees/-/bintrees-1.0.1.tgz", 139 | "integrity": "sha1-DmVcm5wkNeqraL9AJyJtK1WjRSQ=" 140 | }, 141 | "debug": { 142 | "version": "3.2.7", 143 | "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", 144 | "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", 145 | "requires": { 146 | "ms": "^2.1.1" 147 | } 148 | }, 149 | "lodash.get": { 150 | "version": "4.4.2", 151 | "resolved": "https://registry.npmjs.org/lodash.get/-/lodash.get-4.4.2.tgz", 152 | "integrity": "sha1-LRd/ZS+jHpObRDjVNBSZ36OCXpk=" 153 | }, 154 | "ms": { 155 | "version": "2.1.3", 156 | "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", 157 | "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" 158 | }, 159 | "pkginfo": { 160 | "version": "0.4.1", 161 | "resolved": "https://registry.npmjs.org/pkginfo/-/pkginfo-0.4.1.tgz", 162 | "integrity": "sha1-tUGO8EOd5UJfxJlQQtztFPsqhP8=" 163 | }, 164 | "prom-client": { 165 | "version": "12.0.0", 166 | "resolved": "https://registry.npmjs.org/prom-client/-/prom-client-12.0.0.tgz", 167 | "integrity": "sha512-JbzzHnw0VDwCvoqf8y1WDtq4wSBAbthMB1pcVI/0lzdqHGJI3KBJDXle70XK+c7Iv93Gihqo0a5LlOn+g8+DrQ==", 168 | "requires": { 169 | "tdigest": "^0.1.1" 170 | } 171 | }, 172 | "prometheus-api-metrics": { 173 | "version": "3.1.0", 174 | "resolved": "https://registry.npmjs.org/prometheus-api-metrics/-/prometheus-api-metrics-3.1.0.tgz", 175 | "integrity": "sha512-EO+1/74htzL1y6UUGXtUmclr17de5yDXSmeTPaYkbia220yCYI3l6AmJFMBUG9WLf1SAq6EbhgdZhE4mRiO0xQ==", 176 | "requires": { 177 | "@types/express": "^4.17.8", 178 | "@types/express-serve-static-core": "^4.17.12", 179 | "@types/koa": "^2.11.4", 180 | "debug": "^3.2.6", 181 | "lodash.get": "^4.4.2", 182 | "pkginfo": "^0.4.1" 183 | } 184 | }, 185 | "tdigest": { 186 | "version": "0.1.1", 187 | "resolved": "https://registry.npmjs.org/tdigest/-/tdigest-0.1.1.tgz", 188 | "integrity": "sha1-Ljyyw56kSeVdHmzZEReszKRYgCE=", 189 | "requires": { 190 | "bintrees": "1.0.1" 191 | } 192 | } 193 | } 194 | } 195 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "strapi-plugin-prometheus-metrics", 3 | "version": "0.0.4", 4 | "description": "A Strapi plugin to add Prometheus metrics", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "repository": { 10 | "type": "git", 11 | "url": "git+https://github.com/wirehead/strapi-plugin-prometheus-metrics.git" 12 | }, 13 | "keywords": [ 14 | "strapi", 15 | "prometheus", 16 | "metrics" 17 | ], 18 | "engines": { 19 | "node": ">=10.0.0", 20 | "npm": ">=6.0.0" 21 | }, 22 | "author": "Wirehead ", 23 | "license": "SEE LICENSE IN LICENSE.md", 24 | "bugs": { 25 | "url": "https://github.com/wirehead/strapi-plugin-prometheus-metrics/issues" 26 | }, 27 | "homepage": "https://github.com/wirehead/strapi-plugin-prometheus-metrics#readme", 28 | "dependencies": { 29 | "prom-client": "^12.0.0", 30 | "prometheus-api-metrics": "^3.1.0" 31 | } 32 | } 33 | --------------------------------------------------------------------------------