|
| 1 | +# 📍 Checkpoint 24 — Grafana Dashboards and Visualization |
| 2 | + |
| 3 | +## 🎯 Objective |
| 4 | + |
| 5 | +Learn how monitoring data becomes useful through dashboards and visualizations. Understand how Grafana consumes Prometheus metrics and transforms raw numbers into graphs that help engineers monitor applications in real time. |
| 6 | + |
| 7 | +--- |
| 8 | + |
| 9 | +## 📚 Topics Covered |
| 10 | + |
| 11 | +- Grafana fundamentals |
| 12 | +- Grafana dashboards |
| 13 | +- Data sources |
| 14 | +- Metric visualization |
| 15 | +- Time-series monitoring |
| 16 | +- CPU monitoring |
| 17 | +- Memory monitoring |
| 18 | +- Request monitoring |
| 19 | +- PromQL queries |
| 20 | + |
| 21 | +--- |
| 22 | + |
| 23 | +## 🤔 Questions Explored |
| 24 | + |
| 25 | +- What problem does Grafana solve? |
| 26 | +- How does Grafana connect to Prometheus? |
| 27 | +- What is the difference between collecting metrics and visualizing them? |
| 28 | +- Why are dashboards important in production systems? |
| 29 | +- How can engineers detect problems from graphs? |
| 30 | +- What does `rate()` actually measure? |
| 31 | + |
| 32 | +--- |
| 33 | + |
| 34 | +## 🔬 Labs and Experiments |
| 35 | + |
| 36 | +### Lab 1 — Connect Grafana to Prometheus |
| 37 | + |
| 38 | +- Opened Grafana at: |
| 39 | + |
| 40 | +```text |
| 41 | +http://localhost:3001 |
| 42 | +``` |
| 43 | + |
| 44 | +- Added Prometheus as a data source. |
| 45 | +- Verified that Grafana could successfully query Prometheus metrics. |
| 46 | + |
| 47 | +--- |
| 48 | + |
| 49 | +### Lab 2 — Build a Monitoring Dashboard |
| 50 | + |
| 51 | +Created dashboard panels for: |
| 52 | + |
| 53 | +#### Memory Usage |
| 54 | + |
| 55 | +```promql |
| 56 | +process_resident_memory_bytes |
| 57 | +``` |
| 58 | + |
| 59 | +#### CPU Usage |
| 60 | + |
| 61 | +```promql |
| 62 | +process_cpu_seconds_total |
| 63 | +``` |
| 64 | + |
| 65 | +#### Total Requests |
| 66 | + |
| 67 | +```promql |
| 68 | +home_requests_total |
| 69 | +``` |
| 70 | + |
| 71 | +--- |
| 72 | + |
| 73 | +### Lab 3 — Visualize Request Rate |
| 74 | + |
| 75 | +Created a Requests Per Second panel using: |
| 76 | + |
| 77 | +```promql |
| 78 | +rate(home_requests_total[1m]) |
| 79 | +``` |
| 80 | + |
| 81 | +Learned that: |
| 82 | + |
| 83 | +- `home_requests_total` shows the total number of requests. |
| 84 | +- `rate()` calculates how quickly requests arrive. |
| 85 | +- Grafana updates the graph in real time. |
| 86 | + |
| 87 | +--- |
| 88 | + |
| 89 | +### Lab 4 — Generate Application Traffic |
| 90 | + |
| 91 | +Generated traffic using: |
| 92 | + |
| 93 | +```bash |
| 94 | +for i in {1..100}; do |
| 95 | + curl http://localhost:3000 |
| 96 | +done |
| 97 | +``` |
| 98 | + |
| 99 | +Observed: |
| 100 | + |
| 101 | +- CPU usage increased. |
| 102 | +- Memory usage changed over time. |
| 103 | +- Request graphs produced spikes. |
| 104 | + |
| 105 | +--- |
| 106 | + |
| 107 | +## 🧠 Key Concepts |
| 108 | + |
| 109 | +### Grafana |
| 110 | + |
| 111 | +Grafana is a visualization platform used to transform metrics into dashboards and charts. |
| 112 | + |
| 113 | +--- |
| 114 | + |
| 115 | +### Dashboard |
| 116 | + |
| 117 | +A dashboard groups multiple panels into a single view for monitoring system health. |
| 118 | + |
| 119 | +--- |
| 120 | + |
| 121 | +### Visualization |
| 122 | + |
| 123 | +Visualization converts raw numbers into graphs that humans can understand quickly. |
| 124 | + |
| 125 | +--- |
| 126 | + |
| 127 | +### PromQL |
| 128 | + |
| 129 | +PromQL is the query language used by Prometheus to analyze metrics. |
| 130 | + |
| 131 | +Example: |
| 132 | + |
| 133 | +```promql |
| 134 | +rate(home_requests_total[1m]) |
| 135 | +``` |
| 136 | + |
| 137 | +This query asks: |
| 138 | + |
| 139 | +> "How many requests per second occurred during the last minute?" |
| 140 | +
|
| 141 | +--- |
| 142 | + |
| 143 | +### Observability Pipeline |
| 144 | + |
| 145 | +```text |
| 146 | +┌─────────────┐ |
| 147 | +│ Node.js App │ |
| 148 | +└──────┬──────┘ |
| 149 | + │ |
| 150 | + ▼ |
| 151 | +┌─────────────┐ |
| 152 | +│ /metrics │ |
| 153 | +└──────┬──────┘ |
| 154 | + │ |
| 155 | + ▼ |
| 156 | +┌─────────────┐ |
| 157 | +│ Prometheus │ |
| 158 | +└──────┬──────┘ |
| 159 | + │ |
| 160 | + ▼ |
| 161 | +┌─────────────┐ |
| 162 | +│ Grafana │ |
| 163 | +└─────────────┘ |
| 164 | +``` |
| 165 | + |
| 166 | +--- |
| 167 | + |
| 168 | +## 💭 Reflection |
| 169 | + |
| 170 | +Monitoring does not end with collecting metrics. |
| 171 | + |
| 172 | +Prometheus gathers information about the application, but Grafana makes that information understandable through dashboards and visualizations. By observing CPU usage, memory consumption, and request traffic in real time, it becomes easier to investigate performance issues and understand how systems behave under load. |
| 173 | + |
| 174 | +This checkpoint demonstrated that observability is not only about data collection—it is also about presenting data in a way that engineers can quickly interpret. |
| 175 | + |
| 176 | +--- |
| 177 | + |
| 178 | +## 🚀 Next Checkpoint |
| 179 | + |
| 180 | +## ☁️ Phase 8 — Cloud & Orchestration |
| 181 | + |
| 182 | +- [ ] Kubernetes |
| 183 | +- [ ] Helm |
| 184 | +- [ ] Cloud Deployment |
| 185 | +- [ ] Infrastructure Best Practices |
0 commit comments