diff --git a/apis/allquestionservice/allquestions-api.js b/apis/allquestionservice/allquestions-api.js index 871e5652..aa05659a 100644 --- a/apis/allquestionservice/allquestions-api.js +++ b/apis/allquestionservice/allquestions-api.js @@ -2,16 +2,12 @@ const express = require('express'); const mongoose = require('mongoose'); const Question = require('./question-model') const bodyParser = require('body-parser'); -const promBundle = require('express-prom-bundle'); + const app = express(); app.disable('x-powered-by'); const port = 8007; -//Prometheus configuration -const metricsMiddleware = promBundle({includeMethod: true}); -app.use(metricsMiddleware); - const originEndpoint = process.env.REACT_APP_API_ORIGIN_ENDPOINT || 'http://localhost:3000'; const mongoUri = process.env.MONGODB_URI || 'mongodb://localhost:27017/userdb'; diff --git a/apis/alluserservice/allusers-api.js b/apis/alluserservice/allusers-api.js index a696e7cb..154c5aca 100644 --- a/apis/alluserservice/allusers-api.js +++ b/apis/alluserservice/allusers-api.js @@ -1,16 +1,15 @@ const express = require('express'); const mongoose = require('mongoose'); const bodyParser = require('body-parser'); -const promBundle = require('express-prom-bundle'); + const User = require('./user-model') const app = express(); app.disable('x-powered-by'); const port = 8006; -//Prometheus configuration -const metricsMiddleware = promBundle({includeMethod: true}); -app.use(metricsMiddleware); + + const originEndpoint = process.env.REACT_APP_API_ORIGIN_ENDPOINT || 'http://localhost:3000'; diff --git a/gamehistoryservice/gamehistory.js b/gamehistoryservice/gamehistory.js index 4c7e3531..2285e56c 100644 --- a/gamehistoryservice/gamehistory.js +++ b/gamehistoryservice/gamehistory.js @@ -1,7 +1,7 @@ const express = require('express'); const mongoose = require('mongoose'); const bodyParser = require('body-parser'); -const promBundle = require('express-prom-bundle'); + const GameHistory = require('./gamehistory-model.js'); const mongoUri = process.env.MONGODB_URI || 'mongodb://localhost:27017/questiondb'; @@ -13,9 +13,8 @@ const app = express(); app.disable('x-powered-by'); const port = 8004; -//Prometheus configuration -const metricsMiddleware = promBundle({includeMethod: true}); -app.use(metricsMiddleware); + + // Middleware to parse JSON in request body app.use(bodyParser.json()); diff --git a/gatewayservice/gateway-service.js b/gatewayservice/gateway-service.js index 9cbe75da..71a395c2 100644 --- a/gatewayservice/gateway-service.js +++ b/gatewayservice/gateway-service.js @@ -29,7 +29,7 @@ const corsOptions = { app.use(cors(corsOptions)); app.use(express.json()); -//Prometheus configuration +// Prometheus configuration const metricsMiddleware = promBundle({includeMethod: true}); app.use(metricsMiddleware); diff --git a/gatewayservice/monitoring/prometheus/Dockerfile b/gatewayservice/monitoring/prometheus/Dockerfile index 217ffcb7..be023fe0 100644 --- a/gatewayservice/monitoring/prometheus/Dockerfile +++ b/gatewayservice/monitoring/prometheus/Dockerfile @@ -10,4 +10,6 @@ RUN chown -R nonroot:nonroot ./ COPY prometheus.yml ./ -USER nonroot \ No newline at end of file +USER nonroot + +EXPOSE 9090 \ No newline at end of file diff --git a/gatewayservice/monitoring/prometheus/prometheus.yml b/gatewayservice/monitoring/prometheus/prometheus.yml index d893545d..196c9ef4 100644 --- a/gatewayservice/monitoring/prometheus/prometheus.yml +++ b/gatewayservice/monitoring/prometheus/prometheus.yml @@ -4,11 +4,4 @@ scrape_configs: - job_name: "example-nodejs-app" static_configs: - targets: - - "gatewayservice:8000" - - "allquestionservice:8007" - - "alluserservice:8006" - - "gamehistoryservice:8004" - - "perfilservice:8005" - - "questiongenerator:8003" - - "authservice:8002" - - "userservice:8001" \ No newline at end of file + - "gatewayservice:8000" \ No newline at end of file diff --git a/perfilservice/perfil-api.js b/perfilservice/perfil-api.js index 7edd99de..9f36483a 100644 --- a/perfilservice/perfil-api.js +++ b/perfilservice/perfil-api.js @@ -2,15 +2,14 @@ const express = require('express'); const mongoose = require('mongoose'); const User = require('./user-model') const bodyParser = require('body-parser'); -const promBundle = require('express-prom-bundle'); + const app = express(); app.disable('x-powered-by'); const port = 8005; -//Prometheus configuration -const metricsMiddleware = promBundle({includeMethod: true}); -app.use(metricsMiddleware); + + const originEndpoint = process.env.REACT_APP_API_ORIGIN_ENDPOINT || 'http://localhost:3000'; diff --git a/questiongenerator/question.js b/questiongenerator/question.js index 61bf0578..4f18f76e 100644 --- a/questiongenerator/question.js +++ b/questiongenerator/question.js @@ -2,7 +2,7 @@ const axios = require('axios'); const express = require('express'); const mongoose = require('mongoose'); const bodyParser = require('body-parser'); -const promBundle = require('express-prom-bundle'); + const crypto = require('crypto'); const Question = require('./question-model'); const Game = require('./game-model'); @@ -15,9 +15,8 @@ const app = express(); app.disable('x-powered-by'); const port = 8003; -//Prometheus configuration -const metricsMiddleware = promBundle({includeMethod: true}); -app.use(metricsMiddleware); + + var language = 'undefined'; diff --git a/users/authservice/auth-service.js b/users/authservice/auth-service.js index 4888c122..725b4ae1 100644 --- a/users/authservice/auth-service.js +++ b/users/authservice/auth-service.js @@ -2,16 +2,15 @@ const express = require('express'); const mongoose = require('mongoose'); const bcrypt = require('bcrypt'); const jwt = require('jsonwebtoken'); -const promBundle = require('express-prom-bundle'); + const User = require('./auth-model') const app = express(); app.disable('x-powered-by'); const port = 8002; -//Prometheus configuration -const metricsMiddleware = promBundle({includeMethod: true}); -app.use(metricsMiddleware); + + // Middleware to parse JSON in request body app.use(express.json()); diff --git a/users/userservice/user-service.js b/users/userservice/user-service.js index dc9f80b7..2cda7d63 100644 --- a/users/userservice/user-service.js +++ b/users/userservice/user-service.js @@ -3,16 +3,15 @@ const express = require('express'); const mongoose = require('mongoose'); const bcrypt = require('bcrypt'); const bodyParser = require('body-parser'); -const promBundle = require('express-prom-bundle'); + const User = require('./user-model') const app = express(); app.disable('x-powered-by'); const port = 8001; -//Prometheus configuration -const metricsMiddleware = promBundle({includeMethod: true}); -app.use(metricsMiddleware); + + // Middleware to parse JSON in request body app.use(bodyParser.json());