Skip to content

Commit

Permalink
Merge pull request #27 from kentibs/setup/monitoring
Browse files Browse the repository at this point in the history
Setup/monitoring
  • Loading branch information
Tibz-Dankan authored Jan 4, 2024
2 parents d0e804d + 012e870 commit 2eb401d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ volumes:
grafana_data: {}
services:
prometheus:
image: prom/prometheus:v2.20.1
image: prom/prometheus:v2.45.2
container_name: prometheus
volumes:
- ./prometheus:/etc/prometheus
Expand All @@ -19,7 +19,7 @@ services:
networks:
- monitoring
grafana:
image: grafana/grafana:7.1.5
image: grafana/grafana:9.5.15
container_name: grafana
volumes:
- grafana_data:/var/lib/grafana
Expand Down
5 changes: 3 additions & 2 deletions src/controllers/monitoringController.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import promClient from "prom-client";
import { Response, Request, NextFunction } from "express";
import { asyncHandler } from "../utils/asyncHandler";
import url from "url";

const register = new promClient.Registry();

Expand Down Expand Up @@ -35,7 +36,7 @@ export const endRequestMonitoringTimer = (
const statusCode = res.statusCode.toString();

httpRequestDurationMicroseconds
.labels(req.method, req.route.path, statusCode)
.labels(req.method, req.url, statusCode)
.observe(responseTimeInMs);

next();
Expand All @@ -49,7 +50,7 @@ export const getMetrics = asyncHandler(
const statusCode = res.statusCode.toString();

httpRequestDurationMicroseconds
.labels(req.method, req.route.path, statusCode)
.labels(req.method, req.url, statusCode)
.observe(responseTimeInMs);

const metrics = await register.metrics();
Expand Down

0 comments on commit 2eb401d

Please sign in to comment.