This repository contains the centralized monitoring infrastructure for the E-commerce Microservices ecosystem. It utilizes Prometheus for metrics scraping and Grafana for visualization, using a fully declarative approach for datasources and dashboards.
The stack runs on the shared Docker network to discover and scrape metrics from the application services and databases.
- Prometheus (TSDB): Scrapes metrics from Spring Boot Actuator endpoints, PostgreSQL exporters, MongoDB exporters, and RabbitMQ.
- Grafana (UI): Visualizes the data. It is pre-configured to load dashboards from the file system.
.
├── docker-compose.yml # Service orchestration
├── prometheus.yml # Scrape configs (Targets: Apps, DBs, Broker)
└── grafana/
└── provisioning/ # Grafana IaC Configuration
├── datasources/ # Auto-connects to Prometheus
└── dashboards/ # Auto-loads JSON dashboards
├── json/ # Raw Dashboard definitions
└── all.yml # Provider configuration
This project uses Grafana Provisioning to persist dashboards. You do not need to manually import JSON files via the UI. If the container is destroyed and recreated, all dashboards remain available.
| Dashboard Name | File | Description |
|---|---|---|
| Spring Boot System | Spring-Boot-2-1-System-Monitor...json |
CPU, Memory, Uptime, and Heap usage for Java Apps. |
| JVM Micrometer | JVM-(Micrometer)...json |
Detailed JVM metrics (Garbage Collection, Threads, Buffers). |
| PostgreSQL | PostgreSQL-Database...json |
Active connections, transactions, and cache hit rates. |
| MongoDB | Mongodb-Dashboard...json |
Document operations, connections, and memory usage. |
| RabbitMQ | RabbitMQ-Overview...json |
Queue depth, message rates, and consumer count. |
Grafana is configured to automatically add Prometheus as the default datasource on startup:
datasources:
- name: Prometheus
url: http://prometheus:9090
isDefault: trueGrafana watches the /var/lib/grafana/dashboards directory inside the container. Any JSON file placed in grafana/provisioning/dashboards/json on your host is mapped there and instantly loaded.
-
Start the Stack:
docker-compose up -d
-
Access the Interfaces:
- Grafana:
http://localhost:3000- Default Login:
admin/admin(You will be prompted to change this on first login).
- Default Login:
- Prometheus:
http://localhost:9090
- Grafana:
-
Verify Data: Log in to Grafana, go to Dashboards, and you will see the "My Dashboards" folder containing the pre-loaded views.
This stack attaches to the external network shared_ecommerce_network to communicate with:
ecommerce-app(Product API)reviews-app(Reviews API)payment-app(Payment API)postgres-exportermongodb-exporterrabbitmq
Configured for internal monitoring of the E-commerce project.