Skip to content

Commit

Permalink
monitoring init
Browse files Browse the repository at this point in the history
Signed-off-by: Deepanshu Yadav <[email protected]>
  • Loading branch information
deepanshu-yadav committed Jan 5, 2024
1 parent 04fd35d commit f126861
Show file tree
Hide file tree
Showing 9 changed files with 946 additions and 1 deletion.
14 changes: 14 additions & 0 deletions metrics.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// metrics.js

const prometheus = require('prom-client');

const httpRequestDuration = new prometheus.Histogram({
name: 'http_request_duration_seconds',
help: 'Duration of HTTP requests in seconds',
labelNames: ['method', 'route'],
});

module.exports = {
httpRequestDuration,

};
57 changes: 57 additions & 0 deletions monitoring/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
version: '3'

services:
mongodb:
build: mongo
ports:
- "27017:27017"
volumes:
- ./data:/data/db
networks:
- host

nodejs-app:
image: pronoob007/nodejsapp:prod-latest
container_name: nodejsapp
ports:
- "3000:3000"
environment:
MONGO_HOST: mongodb
MONGO_PORT: 27017
depends_on:
- mongodb
links:
- mongodb
networks:
- host

prometheus:
image: prom/prometheus:latest
container_name: prometheus
depends_on:
- nodejsapp
ports:
- "9090:9090"
networks:
- host
volumes:
- "./monitoring/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml"

grafana:
image: grafana/grafana-oss:latest
container_name: grafana
depends_on:
- prometheus
ports:
- "3001:3000"
networks:
- host
volumes:
- ./monitoring/grafana/config.ini:/etc/grafana/grafana.ini
- ./monitoring/grafana/datasource.yml:/etc/grafana/provisioning/datasources/default.yml
- ./monitoring/grafana/dashboard.yml:/etc/grafana/provisioning/dashboards/default.yml
- ./monitoring/grafana/dashboards:/var/lib/grafana/dashboards

networks:
host:
driver: bridge
Loading

0 comments on commit f126861

Please sign in to comment.