Skip to content

Commit 32d7c5b

Browse files
committed
Merge branch 'master' of github.com:E-commerce-Service/Monitoring
2 parents 68df9e2 + 34510da commit 32d7c5b

1 file changed

Lines changed: 86 additions & 0 deletions

File tree

README.md

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
# 📊 Observability & Monitoring Stack
2+
3+
![Prometheus](https://img.shields.io/badge/Prometheus-v3.6-E6522C?style=for-the-badge&logo=prometheus&logoColor=white)
4+
![Grafana](https://img.shields.io/badge/Grafana-v12.3-F46800?style=for-the-badge&logo=grafana&logoColor=white)
5+
![Docker](https://img.shields.io/badge/Docker-2496ED?style=for-the-badge&logo=docker&logoColor=white)
6+
![IaC](https://img.shields.io/badge/IaC-Provisioning-blueviolet?style=for-the-badge)
7+
8+
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.
9+
10+
## 🏗️ Architecture
11+
12+
The stack runs on the shared Docker network to discover and scrape metrics from the application services and databases.
13+
14+
* **Prometheus (TSDB)**: Scrapes metrics from Spring Boot Actuator endpoints, PostgreSQL exporters, MongoDB exporters, and RabbitMQ.
15+
* **Grafana (UI)**: Visualizes the data. It is pre-configured to load dashboards from the file system.
16+
17+
## 📂 Project Structure
18+
19+
```text
20+
.
21+
├── docker-compose.yml # Service orchestration
22+
├── prometheus.yml # Scrape configs (Targets: Apps, DBs, Broker)
23+
└── grafana/
24+
└── provisioning/ # Grafana IaC Configuration
25+
├── datasources/ # Auto-connects to Prometheus
26+
└── dashboards/ # Auto-loads JSON dashboards
27+
├── json/ # Raw Dashboard definitions
28+
└── all.yml # Provider configuration
29+
```
30+
31+
## 🚀 Key Features: Dashboard as Code
32+
33+
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.
34+
35+
### 📈 Included Dashboards
36+
37+
| Dashboard Name | File | Description |
38+
| :--- | :--- | :--- |
39+
| **Spring Boot System** | `Spring-Boot-2-1-System-Monitor...json` | CPU, Memory, Uptime, and Heap usage for Java Apps. |
40+
| **JVM Micrometer** | `JVM-(Micrometer)...json` | Detailed JVM metrics (Garbage Collection, Threads, Buffers). |
41+
| **PostgreSQL** | `PostgreSQL-Database...json` | Active connections, transactions, and cache hit rates. |
42+
| **MongoDB** | `Mongodb-Dashboard...json` | Document operations, connections, and memory usage. |
43+
| **RabbitMQ** | `RabbitMQ-Overview...json` | Queue depth, message rates, and consumer count. |
44+
45+
## 🛠️ Configuration Details
46+
47+
### Datasource Provisioning (`datasource.yml`)
48+
Grafana is configured to automatically add **Prometheus** as the default datasource on startup:
49+
```yaml
50+
datasources:
51+
- name: Prometheus
52+
url: http://prometheus:9090
53+
isDefault: true
54+
```
55+
56+
### Dashboard Provisioning (`all.yml`)
57+
Grafana 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.
58+
59+
## ⚡ Quick Start
60+
61+
1. **Start the Stack:**
62+
```bash
63+
docker-compose up -d
64+
```
65+
66+
2. **Access the Interfaces:**
67+
* **Grafana**: `http://localhost:3000`
68+
* *Default Login*: `admin` / `admin` (You will be prompted to change this on first login).
69+
* **Prometheus**: `http://localhost:9090`
70+
71+
3. **Verify Data:**
72+
Log in to Grafana, go to **Dashboards**, and you will see the "My Dashboards" folder containing the pre-loaded views.
73+
74+
## 🌐 Network
75+
76+
This stack attaches to the external network `shared_ecommerce_network` to communicate with:
77+
* `ecommerce-app` (Product API)
78+
* `reviews-app` (Reviews API)
79+
* `payment-app` (Payment API)
80+
* `postgres-exporter`
81+
* `mongodb-exporter`
82+
* `rabbitmq`
83+
84+
## 📄 License
85+
86+
Configured for internal monitoring of the E-commerce project.

0 commit comments

Comments
 (0)