Skip to content

Commit

Permalink
Eliminada monitorizacion en todos los servicios menos en gateway
Browse files Browse the repository at this point in the history
  • Loading branch information
UO289337 committed Apr 28, 2024
1 parent 863fa61 commit 61612cf
Show file tree
Hide file tree
Showing 10 changed files with 24 additions and 39 deletions.
6 changes: 1 addition & 5 deletions apis/allquestionservice/allquestions-api.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
7 changes: 3 additions & 4 deletions apis/alluserservice/allusers-api.js
Original file line number Diff line number Diff line change
@@ -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';

Expand Down
7 changes: 3 additions & 4 deletions gamehistoryservice/gamehistory.js
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -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());
Expand Down
2 changes: 1 addition & 1 deletion gatewayservice/gateway-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
4 changes: 3 additions & 1 deletion gatewayservice/monitoring/prometheus/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,6 @@ RUN chown -R nonroot:nonroot ./

COPY prometheus.yml ./

USER nonroot
USER nonroot

EXPOSE 9090
9 changes: 1 addition & 8 deletions gatewayservice/monitoring/prometheus/prometheus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
- "gatewayservice:8000"
7 changes: 3 additions & 4 deletions perfilservice/perfil-api.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down
7 changes: 3 additions & 4 deletions questiongenerator/question.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand All @@ -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';

Expand Down
7 changes: 3 additions & 4 deletions users/authservice/auth-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
7 changes: 3 additions & 4 deletions users/userservice/user-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down

0 comments on commit 61612cf

Please sign in to comment.