Skip to content

Commit 4395219

Browse files
authored
Merge pull request #371 from Dev-sandy1/feature/implement-performance-monitoring
Implement Missing Performance Monitoring
2 parents c5119e3 + b70a557 commit 4395219

5 files changed

Lines changed: 708 additions & 2 deletions

File tree

backend/observability/config/alert-rules.yml

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,3 +226,107 @@ groups:
226226
annotations:
227227
summary: "Unusual error rate detected"
228228
description: "Error rate on {{ $labels.service }} deviates significantly from normal"
229+
230+
- name: performance_alerts
231+
interval: 30s
232+
rules:
233+
# High Memory Usage per Service
234+
- alert: HighMemoryUsageService
235+
expr: process_resident_memory_bytes{job=~"user-service|payment-service|billing-service|notification-service|document-service|utility-service|analytics-service|webhook-service"} / 1024 / 1024 / 1024 > 1
236+
for: 5m
237+
labels:
238+
severity: warning
239+
category: performance
240+
annotations:
241+
summary: "High memory usage on {{ $labels.job }}"
242+
description: "Memory usage is {{ $value | humanize }}GB on {{ $labels.job }}"
243+
244+
# High CPU Usage per Service
245+
- alert: HighCPUService
246+
expr: rate(process_cpu_seconds_total{job=~"user-service|payment-service|billing-service|notification-service|document-service|utility-service|analytics-service|webhook-service"}[5m]) * 100 > 80
247+
for: 5m
248+
labels:
249+
severity: warning
250+
category: performance
251+
annotations:
252+
summary: "High CPU usage on {{ $labels.job }}"
253+
description: "CPU usage is {{ $value }}% on {{ $labels.job }}"
254+
255+
# Slow Database Queries
256+
- alert: SlowDatabaseQueries
257+
expr: histogram_quantile(0.95, rate(db_query_duration_seconds_bucket[5m])) > 0.5
258+
for: 5m
259+
labels:
260+
severity: warning
261+
category: database
262+
annotations:
263+
summary: "Slow database queries detected"
264+
description: "95th percentile database query time is {{ $value }}s for {{ $labels.table }} table"
265+
266+
# Database Connection Pool High
267+
- alert: DatabaseConnectionPoolHigh
268+
expr: db_connection_pool_size{state="active"} / (db_connection_pool_size{state="active"} + db_connection_pool_size{state="idle"}) > 0.8
269+
for: 5m
270+
labels:
271+
severity: warning
272+
category: database
273+
annotations:
274+
summary: "Database connection pool utilization high"
275+
description: "Connection pool utilization is {{ $value | humanizePercentage }} for {{ $labels.database }}"
276+
277+
# Low Active Users Alert
278+
- alert: LowActiveUsers
279+
expr: active_users < 10
280+
for: 15m
281+
labels:
282+
severity: info
283+
category: business
284+
annotations:
285+
summary: "Low active users on {{ $labels.service }}"
286+
description: "Only {{ $value }} active users on {{ $labels.service }}"
287+
288+
# High Payment Failure Rate
289+
- alert: PaymentFailureRateHigh
290+
expr: rate(payment_transactions_total{status="failed"}[5m]) / clamp_min(rate(payment_transactions_total[5m]), 1) > 0.05
291+
for: 5m
292+
labels:
293+
severity: critical
294+
category: business
295+
service: payment-service
296+
annotations:
297+
summary: "Payment failure rate is high"
298+
description: "Payment failure rate is {{ $value | humanizePercentage }}"
299+
300+
# Slow Payment Processing
301+
- alert: PaymentProcessingSlow
302+
expr: histogram_quantile(0.95, rate(payment_processing_duration_seconds_bucket[5m])) > 10
303+
for: 5m
304+
labels:
305+
severity: warning
306+
category: performance
307+
service: payment-service
308+
annotations:
309+
summary: "Payment processing is slow"
310+
description: "95th percentile payment processing time is {{ $value }}s"
311+
312+
# High Event Bus Message Failures
313+
- alert: EventBusMessageFailures
314+
expr: rate(event_bus_messages_total{status="failed"}[5m]) > 0.1
315+
for: 5m
316+
labels:
317+
severity: warning
318+
category: messaging
319+
annotations:
320+
summary: "Event bus message failures detected"
321+
description: "Message failure rate is {{ $value }} msg/s for {{ $labels.event_type }}"
322+
323+
# Saga Execution Failures
324+
- alert: SagaExecutionFailures
325+
expr: rate(saga_executions_total{status="failed"}[5m]) > 0.05
326+
for: 5m
327+
labels:
328+
severity: critical
329+
category: saga
330+
annotations:
331+
summary: "Saga execution failures detected"
332+
description: "Saga failure rate is {{ $value }} ops/s for {{ $labels.saga_name }}"

0 commit comments

Comments
 (0)