mirror of
https://framagit.org/les/gancio.git
synced 2025-01-31 08:32:23 +01:00
start prometheus metrics
This commit is contained in:
parent
c948a5bd47
commit
d93315b22c
5 changed files with 59 additions and 13 deletions
|
@ -1,7 +1,9 @@
|
|||
const conf = require('config')
|
||||
const { format, transports } = require('winston')
|
||||
|
||||
module.exports = {
|
||||
telemetry: false,
|
||||
modern: (process.env.NODE_ENV === 'production') && 'client',
|
||||
/*
|
||||
** Headers of the page
|
||||
*/
|
||||
|
@ -60,8 +62,27 @@ module.exports = {
|
|||
['nuxt-express-module', { expressPath: 'server/', routesPath: 'server/routes' }],
|
||||
// Doc: https://axios.nuxtjs.org/usage
|
||||
'@nuxtjs/axios',
|
||||
'@nuxtjs/auth'
|
||||
'@nuxtjs/auth',
|
||||
'nuxt-winston-log'
|
||||
],
|
||||
|
||||
// configure nuxt-winston-log module
|
||||
winstonLog: {
|
||||
skipRequestMiddlewareHandler: true,
|
||||
useDefaultLogger: false,
|
||||
loggerOptions: {
|
||||
transports: process.env.NODE_ENV !== 'production'
|
||||
? [new transports.Console(
|
||||
{ level: 'debug', format: format.combine(format.simple(), format.errors({ stack: true })) }
|
||||
)]
|
||||
: [new transports.File(
|
||||
{
|
||||
filename: 'gancio.log',
|
||||
format: format.combine(format.simple(), format.errors({ stack: true }))
|
||||
}
|
||||
)]
|
||||
}
|
||||
},
|
||||
/*
|
||||
** Axios module configuration
|
||||
* See https://github.com/nuxt-community/axios-module#options
|
||||
|
|
28
package.json
28
package.json
|
@ -6,13 +6,14 @@
|
|||
"scripts": {
|
||||
"build": "nuxt build",
|
||||
"lint": "eslint --ext .js,.vue --ignore-path .gitignore .",
|
||||
"dev": "cross-env DEBUG=*,-babel*,-preview-email,-i18n:debug,-email-templates,-follow-redirects,-send,-body-parser:*,-express:*,-connect:*,-sequelize:* NODE_ENV=development node server/index.js",
|
||||
"dev:nuxt": "cross-env NODE_ENV=development nuxt dev",
|
||||
"dev": "NODE_ENV=development node server/index.js",
|
||||
"dev:nuxt": "cross-env NODE_ENV=development nuxt dev --modern",
|
||||
"doc": "cd docs && bundle exec jekyll b",
|
||||
"doc:dev": "cd docs && bundle exec jekyll s --drafts",
|
||||
"migrate": "NODE_ENV=production sequelize db:migrate",
|
||||
"migrate:dev": "sequelize db:migrate",
|
||||
"start": "cross-env DEBUG=*,-babel*,-preview-email,-i18n:debug,-email-templates,-follow-redirects,-send,-body-parser:*,-express:*,-connect:*,-sequelize:* NODE_ENV=production node server/cli.js"
|
||||
"start:debug": "cross-env DEBUG=* NODE_ENV=production node server/cli.js",
|
||||
"start": "NODE_ENV=production node server/cli.js"
|
||||
},
|
||||
"files": [
|
||||
"server/",
|
||||
|
@ -44,6 +45,7 @@
|
|||
"email-templates": "^8.0.3",
|
||||
"express": "^4.17.1",
|
||||
"express-oauth-server": "^2.0.0",
|
||||
"express-prom-bundle": "^6.3.1",
|
||||
"fs": "^0.0.1-security",
|
||||
"http-signature": "^1.3.5",
|
||||
"ical.js": "^1.4.0",
|
||||
|
@ -51,7 +53,7 @@
|
|||
"inquirer": "^7.3.3",
|
||||
"jsdom": "^16.4.0",
|
||||
"jsonwebtoken": "^8.5.1",
|
||||
"less": "^4.1.0",
|
||||
"less": "^4.1.1",
|
||||
"linkifyjs": "^2.1.9",
|
||||
"lodash": "^4.17.20",
|
||||
"microformat-node": "^2.0.1",
|
||||
|
@ -61,16 +63,18 @@
|
|||
"multer": "^1.4.2",
|
||||
"nuxt": "^2.14.12",
|
||||
"nuxt-express-module": "^0.0.11",
|
||||
"nuxt-winston-log": "^1.2.0",
|
||||
"pg": "^8.5.1",
|
||||
"sequelize": "^6.4.0",
|
||||
"prom-client": "^13.1.0",
|
||||
"sequelize": "^6.5.0",
|
||||
"sequelize-cli": "^6.2.0",
|
||||
"sharp": "^0.27.0",
|
||||
"sharp": "^0.27.1",
|
||||
"sqlite3": "^5.0.1",
|
||||
"tiptap": "^1.31.0",
|
||||
"tiptap-extensions": "^1.34.0",
|
||||
"tiptap": "^1.32.0",
|
||||
"tiptap-extensions": "^1.35.0",
|
||||
"to-ico": "^1.1.5",
|
||||
"url": "^0.11.0",
|
||||
"v-calendar": "^2.2.1",
|
||||
"v-calendar": "^2.2.2",
|
||||
"vue-clipboard2": "^0.3.1",
|
||||
"vue-i18n": "^8.22.4",
|
||||
"yargs": "^16.1.1"
|
||||
|
@ -80,7 +84,7 @@
|
|||
"@nuxtjs/eslint-config": "^5.0.0",
|
||||
"@nuxtjs/vuetify": "^1.11.3",
|
||||
"babel-eslint": "^10.1.0",
|
||||
"eslint": "^7.18.0",
|
||||
"eslint": "^7.19.0",
|
||||
"eslint-config-prettier": "^7.2.0",
|
||||
"eslint-config-standard": "^16.0.2",
|
||||
"eslint-loader": "^4.0.2",
|
||||
|
@ -97,8 +101,8 @@
|
|||
"pug-plain-loader": "^1.1.0",
|
||||
"sass": "^1.32.5",
|
||||
"sass-loader": "^10.1.1",
|
||||
"vue-cli-plugin-vuetify": "~2.0.9",
|
||||
"vuetify-loader": "^1.3.0",
|
||||
"vue-cli-plugin-vuetify": "~2.1.0",
|
||||
"vuetify-loader": "^1.7.1",
|
||||
"webpack-cli": "^4.4.0"
|
||||
},
|
||||
"resolutions": {
|
||||
|
|
7
server/api/controller/metrics.js
Normal file
7
server/api/controller/metrics.js
Normal file
|
@ -0,0 +1,7 @@
|
|||
const User = require('../models/user')
|
||||
|
||||
const metrics = {
|
||||
|
||||
}
|
||||
|
||||
module.exports = metrics
|
9
server/metrics.js
Normal file
9
server/metrics.js
Normal file
|
@ -0,0 +1,9 @@
|
|||
// const promClient = require('prom-client')
|
||||
|
||||
// promClient.Gauge({
|
||||
// name: ''
|
||||
// })
|
||||
|
||||
// module.exports = {
|
||||
|
||||
// }
|
|
@ -13,6 +13,9 @@ const debug = require('debug')('routes')
|
|||
const exportController = require('./api/controller/export')
|
||||
const eventController = require('./api/controller/event')
|
||||
const announceController = require('./api/controller/announce')
|
||||
// const metricsController = require('./metrics')
|
||||
const promBundle = require('express-prom-bundle')
|
||||
const metricsMiddleware = promBundle({ includeMethod: true })
|
||||
|
||||
const helpers = require('./helpers')
|
||||
const app = express()
|
||||
|
@ -20,6 +23,8 @@ const app = express()
|
|||
// ignore unimplemented ping url from fediverse
|
||||
app.use(spamFilter)
|
||||
|
||||
app.use(metricsMiddleware)
|
||||
|
||||
app.use((req, res, next) => {
|
||||
debug(req.method, req.path)
|
||||
next()
|
||||
|
|
Loading…
Reference in a new issue