Skip to content

Commit

Permalink
Merge branch 'feat/monitoring'.
Browse files Browse the repository at this point in the history
  • Loading branch information
dleclercpro committed Dec 28, 2023
2 parents dccdd3a + 6579fa0 commit cfb21b7
Show file tree
Hide file tree
Showing 48 changed files with 1,258 additions and 109 deletions.
19 changes: 19 additions & 0 deletions Apps/Broker/src/controllers/MetricsController.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { RequestHandler } from 'express';
import { HttpStatusCode } from '../../../Common/src/types/HTTPTypes';
import logger from '../logger';

const MetricsController: RequestHandler = async (req, res) => {
try {
logger.trace(`Metrics: NONE`);

return res.send(`# No metrics available.`);

} catch (err: any) {
logger.error(err);

// Unknown error
return res.sendStatus(HttpStatusCode.INTERNAL_SERVER_ERROR);
}
}

export default MetricsController;
2 changes: 2 additions & 0 deletions Apps/Broker/src/routes/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import UnsubscribeController from '../controllers/UnsubscribeController';
import PublishController from '../controllers/PublishController';
import OrderController from '../controllers/OrderController';
import ReadyController from '../controllers/ReadyController';
import MetricsController from '../controllers/MetricsController';



Expand All @@ -21,6 +22,7 @@ router.use('/', express.static('public'));
// Probes
router.get('/health', HealthController);
router.get('/ready', ReadyController);
router.get('/metrics', MetricsController);

// API
router.put(`/subscribe`, SubscribeController);
Expand Down
19 changes: 19 additions & 0 deletions Apps/Delivery/src/controllers/MetricsController.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { RequestHandler } from 'express';
import { HttpStatusCode } from '../../../Common/src/types/HTTPTypes';
import logger from '../logger';

const MetricsController: RequestHandler = async (req, res) => {
try {
logger.trace(`Metrics: NONE`);

return res.send(`# No metrics available.`);

} catch (err: any) {
logger.error(err);

// Unknown error
return res.sendStatus(HttpStatusCode.INTERNAL_SERVER_ERROR);
}
}

export default MetricsController;
2 changes: 2 additions & 0 deletions Apps/Delivery/src/routes/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Router } from 'express';
import HealthController from '../controllers/HealthController';
import ReadyController from '../controllers/ReadyController';
import NotifyController from '../controllers/NotifyController';
import MetricsController from '../controllers/MetricsController';



Expand All @@ -13,6 +14,7 @@ const router = Router();
// Probes
router.get('/health', HealthController);
router.get('/ready', ReadyController);
router.get('/metrics', MetricsController);

// API
router.post(`/notify`, NotifyController);
Expand Down
8 changes: 8 additions & 0 deletions Apps/Grafana.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Use latest Grafana image
FROM grafana/grafana

# Copy configuration file over to image
COPY ./Grafana/grafana.ini /etc/grafana/

# Expose necessary port to talk with service
EXPOSE 3000
Loading

0 comments on commit cfb21b7

Please sign in to comment.