Skip to content

Commit

Permalink
removed usage of express-prometheus-middleware due to #34
Browse files Browse the repository at this point in the history
  • Loading branch information
srfrnk committed Dec 12, 2021
1 parent f5aea35 commit 0d0699c
Show file tree
Hide file tree
Showing 4 changed files with 2,110 additions and 674 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ All metrics are exported into `Prometheus` using the `ServiceMonitor` API by `ku
To otherwise configure `Prometheus` to collect the metrics you need to point it to 'OPERATOR_POD_IP:3000/metrics'.

All metrics exported are prefixed with `jabos_operator_`.
Numerous metrics are exported most of them describe `nodsjs` and `expresjs` operations.
Numerous metrics are exported most of them describe `nodsjs` and `expresjs` operations. [**Removed due to security audit fails**](#34)

Important metrics for the operation of Jabos are:

Expand Down Expand Up @@ -219,4 +219,4 @@ Important metrics for the operation of Jabos are:
- Jabos uses <a href="https://github.com/prometheus-community/helm-charts/tree/main/charts/kube-prometheus-stack" target="_blank">kube-prometheus-stack</a> for local monitoring and alerting.
- Jabos uses <a href="https://www.gnu.org/software/parallel/" target="_blank">GNU Parallel</a> for local port-forwarding to multiple services
- Jabos uses <a href="https://github.com/expressjs/express" target="_blank">expressjs</a> as the web server to run the operator
- Jabos uses <a href="https://github.com/joao-fontenele/express-prometheus-middleware" target="_blank">express-prometheus-middleware</a> to export basic metrics to prometheus
- [**Removed due to security audit fails**](#34) - Jabos uses <a href="https://github.com/joao-fontenele/express-prometheus-middleware" target="_blank">express-prometheus-middleware</a> to export basic metrics to prometheus
18 changes: 9 additions & 9 deletions operator/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import express, { Request, Response, NextFunction } from 'express';
import asyncHandler from 'express-async-handler'
import prometheusMiddleware from 'express-prometheus-middleware';
// import prometheusMiddleware from 'express-prometheus-middleware';

import gitRepositories from './gitRepositories';
import dockerImages from './dockerImages';
Expand All @@ -19,14 +19,14 @@ app.listen(settings.port(), () => {
console.log(`Server running on port ${settings.port()}.`);
});

app.use(prometheusMiddleware({
metricsPath: '/metrics',
collectDefaultMetrics: true,
requestDurationBuckets: [0.1, 0.5, 1, 1.5],
requestLengthBuckets: [512, 1024, 5120, 10240, 51200, 102400],
responseLengthBuckets: [512, 1024, 5120, 10240, 51200, 102400],
prefix: settings.prometheusMetricPrefix(),
}));
// app.use(prometheusMiddleware({
// metricsPath: '/metrics',
// collectDefaultMetrics: true,
// requestDurationBuckets: [0.1, 0.5, 1, 1.5],
// requestLengthBuckets: [512, 1024, 5120, 10240, 51200, 102400],
// responseLengthBuckets: [512, 1024, 5120, 10240, 51200, 102400],
// prefix: settings.prometheusMetricPrefix(),
// }));

app.get('/', asyncHandler(async (request: Request, response: Response, next: NextFunction) => {
response.status(200).json({ status: 'ok' });
Expand Down
Loading

0 comments on commit 0d0699c

Please sign in to comment.