---
title: "HeliosDB Monitoring and Alerting Operations Guide"
---

# HeliosDB Monitoring and Alerting Operations Guide

**Version**: 1.0
**Target Audience**: SREs, Operations Engineers, Database Administrators

---

## Table of Contents

1. [Overview](#overview)
2. [Architecture Overview](#architecture-overview)
3. [Metrics Collection](#metrics-collection)
4. [Dashboards](#dashboards)
5. [Alerting](#alerting)
6. [Distributed Tracing](#distributed-tracing)
7. [Log Aggregation](#log-aggregation)
8. [SLO Monitoring](#slo-monitoring)
9. [Anomaly Detection](#anomaly-detection)
10. [Runbooks](#runbooks)
11. [Troubleshooting](#troubleshooting)
12. [Best Practices](#best-practices)

---

## Overview

### What This Document Covers

This guide documents HeliosDB's monitoring and alerting setup, covering:

- **Metrics Collection**: 150+ metrics across all components
- **Dashboards**: 50+ Grafana dashboards for all features
- **Alerting**: 200+ alert rules with P0-P3 severity levels
- **Distributed Tracing**: OpenTelemetry integration for full request tracing
- **Log Aggregation**: ELK Stack and Splunk integration
- **SLO Monitoring**: Service Level Objectives with error budgets
- **Anomaly Detection**: ML-powered anomaly detection and intelligent alerting

### Key Metrics at a Glance

| Metric | Target | Critical Threshold |
|--------|--------|-------------------|
| **Availability** | 99.9% | <99.5% |
| **P99 Latency** | <500ms | >1000ms |
| **P95 Latency** | <100ms | >500ms |
| **Error Rate** | <0.1% | >1% |
| **Replication Lag** | <10s | >60s |
| **Cache Hit Rate** | >80% | <60% |

---

## Architecture Overview

### Monitoring Stack Components

```
┌─────────────────────────────────────────────────────────────┐
│                      HeliosDB Cluster                        │
│  ┌──────────┐  ┌──────────┐  ┌──────────┐                  │
│  │ Node 1   │  │ Node 2   │  │ Node 3   │                  │
│  │ :9090    │  │ :9090    │  │ :9090    │                  │
│  └────┬─────┘  └────┬─────┘  └────┬─────┘                  │
│       │             │             │                          │
│       │ Metrics     │             │                          │
│       │ Traces      │             │                          │
│       │ Logs        │             │                          │
└───────┼─────────────┼─────────────┼──────────────────────────┘
        │             │             │
        ▼             ▼             ▼
┌─────────────────────────────────────────────────────────────┐
│                 OpenTelemetry Collector                      │
│  ┌──────────────┐  ┌──────────────┐  ┌──────────────┐     │
│  │   Receivers  │  │  Processors  │  │   Exporters  │     │
│  │ OTLP/Jaeger  │  │   Sampling   │  │ Prom/Jaeger  │     │
│  │  Prometheus  │  │  Enrichment  │  │   ES/Loki    │     │
│  └──────────────┘  └──────────────┘  └──────────────┘     │
└─────────────────────────────────────────────────────────────┘
        │                      │                      │
        ▼                      ▼                      ▼
┌─────────────┐      ┌─────────────┐      ┌─────────────┐
│ Prometheus  │      │   Jaeger    │      │ ELK Stack   │
│   Metrics   │      │   Traces    │      │    Logs     │
│   Storage   │      │   Storage   │      │   Storage   │
└──────┬──────┘      └──────┬──────┘      └──────┬──────┘
       │                    │                     │
       ▼                    ▼                     ▼
┌─────────────────────────────────────────────────────────────┐
│                        Grafana                               │
│  ┌──────────┐  ┌──────────┐  ┌──────────┐  ┌──────────┐   │
│  │  System  │  │ Feature  │  │   SLO    │  │ Anomaly  │   │
│  │ Overview │  │ Specific │  │Monitoring│  │Detection │   │
│  └──────────┘  └──────────┘  └──────────┘  └──────────┘   │
└─────────────────────────────────────────────────────────────┘
                               │
                               ▼
                    ┌──────────────────────┐
                    │   Alertmanager       │
                    │   - Routing          │
                    │   - Deduplication    │
                    │   - Silencing        │
                    └──────────────────────┘
                               │
            ┌──────────────────┼──────────────────┐
            ▼                  ▼                  ▼
     ┌────────────┐     ┌────────────┐    ┌────────────┐
     │ PagerDuty  │     │   Slack    │    │   Email    │
     └────────────┘     └────────────┘    └────────────┘
```

### Data Flow

1. **Metrics Export**: HeliosDB exports Prometheus metrics on `/metrics` endpoint
2. **Trace Generation**: OpenTelemetry SDK generates traces for all operations
3. **Log Emission**: Structured JSON logs written to files
4. **Collection**: OpenTelemetry Collector scrapes/receives data
5. **Processing**: Sampling, enrichment, filtering, correlation
6. **Storage**: Prometheus (metrics), Jaeger/Tempo (traces), Elasticsearch/Loki (logs)
7. **Visualization**: Grafana queries all data sources
8. **Alerting**: Prometheus evaluates alert rules, Alertmanager handles notifications

---

## Metrics Collection

### Available Metrics

#### Core Database Metrics (P0 - Critical)

```promql
# Query performance
heliosdb_queries_total{query_type, status, protocol}
heliosdb_query_duration_seconds_bucket{query_type, protocol}
heliosdb_query_rows_scanned{query_type}
heliosdb_query_rows_returned{query_type}

# Transactions
heliosdb_transactions_total{type, status}
heliosdb_transaction_duration_seconds{type}
heliosdb_active_transactions{type}
heliosdb_transaction_conflicts_total{conflict_type}

# Connections
heliosdb_active_connections{protocol}
heliosdb_connection_wait_seconds{protocol}
heliosdb_connection_errors_total{protocol, error_type}

# Storage
heliosdb_storage_operations_total{operation, status}
heliosdb_storage_operation_duration_seconds{operation}
heliosdb_storage_bytes_read_total{tier}
heliosdb_storage_bytes_written_total{tier}
heliosdb_memtable_size_bytes{table}
heliosdb_compaction_queue_depth{level}
```

#### Multi-Model Database Metrics

```promql
# Vector database
heliosdb_vector_search_operations_total{index_type, status}
heliosdb_vector_search_duration_seconds{index_type}
heliosdb_vector_index_size{index_name, dimensions}

# Graph database
heliosdb_graph_traversal_operations_total{traversal_type, status}
heliosdb_graph_traversal_duration_seconds{traversal_type}
heliosdb_graph_nodes{graph_name, node_type}
heliosdb_graph_edges{graph_name, edge_type}

# Document store
heliosdb_document_operations_total{operation, collection, status}
heliosdb_document_size_bytes{collection}

# Time-series
heliosdb_timeseries_ingest_rate{metric}
heliosdb_timeseries_compression_ratio{metric}
```

#### Distributed Systems Metrics

```promql
# Cluster health
heliosdb_cluster_nodes{status}
heliosdb_cluster_leader_elections_total
heliosdb_cluster_split_brain_detected_total

# Replication
heliosdb_replication_lag_seconds{source, target, region}
heliosdb_replication_synced_bytes_total{source, target}
heliosdb_replication_conflicts_total{conflict_type, resolution}
heliosdb_replication_queue_depth{source, target}

# Sharding
heliosdb_shard_operations_total{operation, status}
heliosdb_shard_rebalancing_active
heliosdb_shard_data_size_bytes{shard_id}

# Multi-region
heliosdb_cross_region_latency_seconds{source_region, target_region}
heliosdb_region_failover_operations_total{from_region, to_region, status}
```

### Querying Metrics

#### Common PromQL Queries

**Calculate error rate:**
```promql
sum(rate(heliosdb_queries_total{status="error"}[5m]))
/
sum(rate(heliosdb_queries_total[5m]))
* 100
```

**P95 latency:**
```promql
histogram_quantile(0.95,
  sum(rate(heliosdb_query_duration_seconds_bucket[5m])) by (le, query_type)
) * 1000
```

**Cache hit rate:**
```promql
sum(rate(heliosdb_cache_hits_total[5m])) by (cache_type)
/
(
  sum(rate(heliosdb_cache_hits_total[5m])) by (cache_type)
  +
  sum(rate(heliosdb_cache_misses_total[5m])) by (cache_type)
) * 100
```

**Top queries by duration:**
```promql
topk(10,
  sum(rate(heliosdb_query_duration_seconds_sum[5m])) by (query_type)
  /
  sum(rate(heliosdb_query_duration_seconds_count[5m])) by (query_type)
)
```

---

## Dashboards

### Available Dashboards

#### 1. System Overview Dashboard
**Purpose**: High-level system health and performance
**Panels**:
- Cluster health (healthy nodes)
- Query rate (QPS)
- Error rate
- P99 latency
- Active connections
- Replication lag
- Query rate by type (graph)
- Query latency percentiles (graph)
- CPU usage by node
- Memory usage by node
- Disk usage by node
- Network I/O
- Storage operations
- Compaction queue depth
- Cache performance
- Active alerts table

#### 2. Vector Database Dashboard
**Panels**:
- Search operations/sec
- P95 search latency
- Total vectors indexed
- Insert rate
- Search latency distribution
- Index size growth
- HNSW performance metrics
- Vector dimension distribution

#### 3. Graph Database Dashboard
**Panels**:
- Traversal operations/sec
- P95 traversal latency
- Total nodes/edges
- Graph density
- Traversal patterns
- Cypher query performance
- PageRank/centrality metrics

#### 4. Multi-Tenancy Dashboard
**Panels**:
- Active tenants
- Data size by tenant (top 10)
- Query rate by tenant (top 10)
- Tenant quotas vs usage
- Noisy neighbor detection
- Cross-tenant isolation metrics

#### 5. Replication Dashboard
**Panels**:
- Replication lag heatmap
- Throughput by replication stream
- Conflict rate
- Queue depth
- Sync status
- Cross-region latency matrix

#### 6. Security Dashboard
**Panels**:
- Authentication attempts/failures
- Authorization checks
- Security violations
- Audit events
- Suspicious activity detection
- Failed login attempts by IP

#### 7. Cache Performance Dashboard
**Panels**:
- Hit rate by cache tier
- Eviction rate
- Cache size
- Operation latency
- Cache efficiency trends

#### 8. ML Features Dashboard
**Panels**:
- Model inference rate
- Model latency
- Auto-index creation rate
- Optimizer invocations
- Improvement ratio
- NL2SQL confidence scores

#### 9. Edge Computing Dashboard
**Panels**:
- Active edge nodes
- Sync lag by edge node
- Edge function invocations
- Total edge data
- Edge network latency

#### 10. Lakehouse Integration Dashboard (planned)
**Panels**:
- Tables by format (Iceberg, Delta, Hudi)
- Query operations by format
- Metadata operations
- Compaction activity
- Table size distribution

#### Additional Dashboards

11. **OLTP/OLAP Workloads**: Transaction performance and analytical query metrics
12. **Sharding & Rebalancing**: Shard distribution and rebalancing activity
13. **Multi-Region**: Cross-region performance and failover metrics
14. **Cost Management**: Query costs and resource optimization
15. **NL2SQL**: Natural language query performance
16. **Document Store**: MongoDB-compatible document operations
17. **Time-Series**: Time-series ingestion and compression
18. **Distributed Tracing**: Trace visualization and analysis
19. **Workload Optimizer**: Query optimization metrics
20. **Compression**: Compression ratios and performance

### Dashboard Navigation

**Best Practices:**
1. Start with System Overview dashboard for overall health
2. Drill down to feature-specific dashboards for detailed analysis
3. Use time range selector to focus on incident timeframes
4. Use template variables to filter by cluster, instance, tenant
5. Enable auto-refresh (30s recommended) for real-time monitoring

---

## Alerting

### Alert Severity Levels

| Severity | Priority | Response Time | Notification | Action |
|----------|----------|---------------|--------------|--------|
| **Critical** | P0 | Immediate (5 min) | PagerDuty + Phone | Page on-call, start incident |
| **High** | P1 | 15 minutes | Slack + Email | Notify team, investigate |
| **Warning** | P2 | 1 hour | Slack | Monitor, plan action |
| **Info** | P3 | Next business day | Slack (monitoring) | Log for review |

### Critical Alerts (P0)

#### DatabaseDown
**Description**: HeliosDB node is completely down
**Query**: `up{job="heliosdb"} == 0`
**Duration**: 30s
**Impact**: Data unavailability, potential data loss
**Runbook**: https://www.heliosdb.com/docs/full/

#### ClusterQuorumLost
**Description**: Less than majority of nodes are healthy
**Query**: `count(up{job="heliosdb"} == 1) < (count(up{job="heliosdb"}) / 2 + 1)`
**Duration**: 30s
**Impact**: Write operations blocked, data inconsistency risk
**Runbook**: https://www.heliosdb.com/docs/full/

#### CriticalQueryErrorRate
**Description**: Query error rate exceeds 5%
**Query**: `sum(rate(heliosdb_queries_total{status="error"}[1m])) / sum(rate(heliosdb_queries_total[1m])) > 0.05`
**Duration**: 2m
**Impact**: Widespread query failures affecting users
**Runbook**: https://www.heliosdb.com/docs/full/

#### CriticalReplicationFailure
**Description**: Replication lag exceeds 5 minutes
**Query**: `heliosdb_replication_lag_seconds > 300`
**Duration**: 5m
**Impact**: Data consistency at risk, failover risk
**Runbook**: https://www.heliosdb.com/docs/full/

#### OutOfMemory
**Description**: Memory usage exceeds 98%
**Query**: `(heliosdb_memory_usage_bytes{type="total"} / heliosdb_memory_usage_bytes{type="limit"}) > 0.98`
**Duration**: 1m
**Impact**: Imminent OOM kills, database crash risk
**Runbook**: https://www.heliosdb.com/docs/full/

#### DiskFull
**Description**: Disk usage exceeds 95%
**Query**: `(heliosdb_disk_usage_bytes / heliosdb_disk_usage_bytes{type="capacity"}) > 0.95`
**Duration**: 2m
**Impact**: Write operations will fail, database may crash
**Runbook**: https://www.heliosdb.com/docs/full/

### High Priority Alerts (P1)

#### HighQueryLatencyP99
**Description**: P99 query latency exceeds 1 second
**Query**: `histogram_quantile(0.99, sum(rate(heliosdb_query_duration_seconds_bucket[5m])) by (le)) > 1.0`
**Duration**: 5m
**Impact**: Poor user experience, SLA at risk
**Action**: Analyze slow queries, check for missing indexes

#### HighConnectionPoolUtilization
**Description**: Connection pool at 85%+ utilization
**Query**: `heliosdb_active_connections / heliosdb_active_connections{type="max"} > 0.85`
**Duration**: 10m
**Impact**: Connection timeouts imminent
**Action**: Increase pool size or scale horizontally

#### CacheHitRateDegraded
**Description**: Cache hit rate below 60%
**Query**: `sum(rate(heliosdb_cache_hits_total[10m])) / (sum(rate(heliosdb_cache_hits_total[10m])) + sum(rate(heliosdb_cache_misses_total[10m]))) < 0.6`
**Duration**: 15m
**Impact**: Increased storage I/O, query latency
**Action**: Increase cache size, analyze eviction patterns

### Alert Response Workflow

```
Alert Fires
    │
    ▼
┌─────────────────┐
│ Alertmanager    │
│ - Deduplication │
│ - Grouping      │
│ - Routing       │
└────────┬────────┘
         │
         ├──────────────────────────────┐
         ▼                              ▼
    [Critical?]                    [High/Warning?]
         │                              │
         ▼                              ▼
  ┌──────────────┐              ┌──────────────┐
  │  PagerDuty   │              │    Slack     │
  │  + Phone     │              │   + Email    │
  └──────┬───────┘              └──────┬───────┘
         │                              │
         ▼                              ▼
  ┌──────────────┐              ┌──────────────┐
  │ On-call Eng  │              │  Team Lead   │
  │ Acknowledges │              │   Reviews    │
  └──────┬───────┘              └──────┬───────┘
         │                              │
         ▼                              ▼
  ┌──────────────┐              ┌──────────────┐
  │   Follow     │              │   Monitor    │
  │   Runbook    │              │  & Plan Fix  │
  └──────┬───────┘              └──────────────┘
         │
         ▼
  ┌──────────────┐
  │  Mitigate    │
  │   Issue      │
  └──────┬───────┘
         │
         ▼
  ┌──────────────┐
  │   Resolve    │
  │    Alert     │
  └──────┬───────┘
         │
         ▼
  ┌──────────────┐
  │ Post-Mortem  │
  │   (if P0/P1) │
  └──────────────┘
```

---

## Distributed Tracing

### Trace Instrumentation

HeliosDB automatically instruments all operations with OpenTelemetry:

**Trace Hierarchy:**
```
Query Request (Root Span)
│
├─ Authentication (Span)
│
├─ Authorization (Span)
│
├─ Query Parsing (Span)
│
├─ Query Planning (Span)
│  ├─ Cost Estimation
│  └─ Index Selection
│
├─ Query Execution (Span)
│  ├─ Storage Read (Span)
│  │  ├─ Cache Lookup
│  │  └─ Disk Read (if cache miss)
│  ├─ Index Scan (Span)
│  └─ Filter/Join Operations (Span)
│
└─ Result Serialization (Span)
```

### Trace Attributes

Every span includes:
- `trace_id`: Unique trace identifier
- `span_id`: Unique span identifier
- `parent_span_id`: Parent span (for hierarchy)
- `service.name`: "heliosdb"
- `service.version`: "x.y.z"
- `deployment.environment`: "production"
- `db.system`: "heliosdb"
- `db.operation`: Query type (SELECT, INSERT, etc.)
- `db.statement`: Hashed SQL statement
- `db.table`: Table name
- `db.rows_affected`: Number of rows
- `duration_ms`: Span duration
- `tenant_id`: Tenant identifier
- `query_complexity`: low/medium/high
- `slo.met`: true/false

### Viewing Traces

**Common Searches:**
```
# Find slow queries
duration > 1s

# Find errors
error=true

# Find specific query type
db.operation=SELECT

# Find distributed transactions
transaction.distributed=true

# Find queries for specific tenant
tenant_id=abc123

# Find queries missing SLO
slo.met=false
```

### Trace Sampling

- **Always sampled**: Errors, slow queries (>1s), distributed transactions
- **High sample rate (50%)**: P99+ latency queries
- **Medium sample rate (10%)**: Normal queries
- **Low sample rate (1%)**: Health checks
- **Never sampled**: Internal monitoring

---

## Log Aggregation

### Log Structure

All logs are emitted in structured JSON format:

```json
{
  "timestamp": "2025-11-24T10:30:45.123Z",
  "level": "INFO",
  "category": "query",
  "message": "Query executed successfully",
  "service": "heliosdb",
  "version": "x.y.z",
  "environment": "production",
  "cluster": "prod-cluster-01",
  "node_id": "node-01",
  "region": "us-east-1",
  "query_id": "q-12345",
  "query_type": "SELECT",
  "duration_ms": 45.2,
  "rows_returned": 100,
  "cache_hit": true,
  "tenant_id": "tenant-uuid",
  "trace_id": "abc123",
  "span_id": "xyz789"
}
```

### Log Categories

- **query**: Query execution and optimization
- **transaction**: Transaction lifecycle
- **storage**: Storage engine operations
- **replication**: Replication and sync
- **security**: Authentication, authorization, audit
- **network**: Network communication
- **cache**: Cache operations
- **ml**: ML model inference
- **system**: System-level events

### Searching Logs

**Kibana (ELK)**:

**Common Queries:**
```
# Find errors in last hour
level:ERROR AND @timestamp:[now-1h TO now]

# Find slow queries
category:query AND duration_ms:>1000

# Find security violations
category:security AND event_type:unauthorized_access

# Find queries for specific tenant
tenant_id:"abc123"

# Find queries that missed SLO
slo.met:false

# Correlate logs with traces
trace_id:"abc123"
```

**Splunk**:

```spl
# Error rate trend
index=heliosdb_logs level=ERROR
| timechart count by category

# Slow query analysis
index=heliosdb_queries duration_ms>1000
| stats avg(duration_ms) p95(duration_ms) p99(duration_ms) count by query_type

# Security audit
index=heliosdb_audit category=security
| stats count by event_type, user_id
| sort -count
```

---

## SLO Monitoring

### Defined SLOs

#### Availability SLO
- **Target**: 99.9% (three nines)
- **Window**: 30 days
- **Error Budget**: 43.2 minutes/month

#### Latency SLOs
- **P95 Latency**: <100ms (all queries)
- **P99 Latency**: <500ms (OLTP queries)
- **Window**: 30 days

#### Data Freshness SLO
- **Replication Lag**: <10 seconds
- **Window**: 30 days

### Error Budget

**Formula:**
```
Error Budget Remaining = (1 - (Actual Availability / Target Availability)) × 100
```

**Burn Rate:**
```
Burn Rate = (Error Budget Consumed / Time Elapsed) / (Total Error Budget / SLO Window)
```

**Alert Thresholds:**
- **Fast Burn (14.4x)**: 1% budget consumed in 1 hour → Page immediately
- **Moderate Burn (6x)**: 5% budget consumed in 6 hours → Alert team
- **Slow Burn (1x)**: 10% budget consumed in 3 days → Notify for review

### SLO Dashboard

**Panels:**
- SLO compliance status (green/yellow/red)
- Error budget remaining (%)
- Current burn rate
- SLI trends (7-day)
- Top SLO violations
- Projected budget exhaustion

---

## Anomaly Detection

### Detection Methods

#### 1. Statistical Detection
- **Z-Score**: Detects values >3 standard deviations from mean
- **ARIMA**: Forecasts expected values, detects deviations
- **Exponential Smoothing**: Detects trend changes

#### 2. ML-Based Detection
- **Isolation Forest**: Detects multivariate anomalies
- **LSTM**: Predicts time-series, detects deviations
- **Autoencoders**: Learns normal patterns, detects unusual patterns

#### 3. Rule-Based Detection
- **Sudden Spike**: Value far above the rolling average
- **Sudden Drop**: Value far below the rolling average
- **Unusual Pattern**: Deviation from historical patterns

### Anomaly Scoring

Anomalies are scored 0.0-1.0 based on confidence:
- **>0.9**: Critical anomaly (investigate immediately)
- **>0.75**: High confidence anomaly (investigate soon)
- **>0.5**: Medium confidence anomaly (monitor)
- **>0.3**: Low confidence anomaly (log only)

### Anomaly Dashboard

**Panels:**
- Detected anomalies (last 24h)
- Anomaly score timeline
- Baseline vs actual metrics
- Anomaly heatmap
- Top anomalous metrics

---

## Runbooks

### Critical Runbooks

#### Database Down
**Trigger**: Node completely unreachable
**Steps**:
1. Check node status: `systemctl status heliosdb`
2. Check logs: `journalctl -u heliosdb -n 100`
3. If OOM killed: Increase memory, restart
4. If crash: Check core dump, restart
5. If disk full: Clean up space, restart
6. Verify cluster health after restart
**Escalation**: If restart fails, page DBA lead

#### Quorum Lost
**Trigger**: Less than majority of nodes healthy
**Steps**:
1. Identify down nodes
2. Check network connectivity between nodes
3. Check for split-brain scenario
4. Restore down nodes ASAP
5. Verify cluster reformed correctly
**Escalation**: If network partition, engage network team

#### High Error Rate
**Trigger**: Query error rate >1%
**Steps**:
1. Check error logs for common patterns
2. Identify affected query types
3. Check for recent schema/code changes
4. Check resource utilization (CPU, memory, disk)
5. Roll back recent changes if applicable
6. Scale up resources if needed
**Escalation**: If errors continue, page on-call engineer

#### Out of Memory
**Trigger**: Memory usage >98%
**Steps**:
1. Identify memory consumers: Check cache size, active queries
2. Kill long-running queries if necessary
3. Reduce cache sizes temporarily
4. Check for memory leaks in recent changes
5. Scale up memory or scale horizontally
6. Investigate root cause after mitigation
**Prevention**: Tune cache sizes, set query timeouts

---

## Troubleshooting

### Common Issues

#### High Latency
**Symptoms**: P95/P99 latency elevated
**Investigation**:
1. Check CPU/memory/disk utilization
2. Check cache hit rate
3. Analyze slow query log
4. Check for missing indexes
5. Check replication lag
6. Check compaction backlog
**Solutions**:
- Add missing indexes
- Optimize queries
- Increase cache size
- Scale resources
- Rebalance shards

#### High Error Rate
**Symptoms**: Elevated query failures
**Investigation**:
1. Check error logs for patterns
2. Check affected query types
3. Check recent deployments
4. Check resource limits
5. Check authentication issues
**Solutions**:
- Roll back bad deployment
- Fix query bugs
- Increase resource limits
- Fix authentication configuration

#### Replication Lag
**Symptoms**: Lag >10 seconds
**Investigation**:
1. Check network bandwidth
2. Check target node load
3. Check replication queue size
4. Check for conflicts
5. Check write rate
**Solutions**:
- Increase network bandwidth
- Scale target node
- Increase replication threads
- Reduce write rate temporarily
- Resolve conflicts

#### Cache Miss Rate High
**Symptoms**: Hit rate <60%
**Investigation**:
1. Check cache size
2. Check eviction rate
3. Check query patterns
4. Check data hot spots
**Solutions**:
- Increase cache size
- Adjust eviction policy
- Optimize query patterns
- Partition hot data

### Diagnostic Queries

#### Check Node Health
```bash
curl http://localhost:9090/health
```

```bash
curl http://localhost:9090/api/v1/cluster/status | jq
```

#### Check Active Queries
```bash
curl http://localhost:9090/api/v1/queries/active | jq
```

```bash
curl http://localhost:9090/api/v1/replication/status | jq
```

#### Check Cache Statistics
```bash
curl http://localhost:9090/api/v1/cache/stats | jq
```

---

## Best Practices

### Monitoring

1. **Set Realistic SLOs**: Base on actual user requirements, not arbitrary targets
2. **Monitor What Matters**: Focus on user-facing metrics first
3. **Use Error Budgets**: Allow controlled risk-taking and innovation
4. **Automate Responses**: Auto-remediate safe, well-understood issues
5. **Correlate Data**: Link metrics, traces, and logs for full context
6. **Review Regularly**: Conduct weekly SLO reviews, monthly retrospectives

### Alerting

1. **Reduce Noise**: Every alert should be actionable
2. **Use Severity Levels**: P0 = page, P1 = email, P2 = ticket
3. **Write Runbooks**: Every alert should have a runbook
4. **Test Alerts**: Regularly test alert routing and escalation
5. **Suppress Known Issues**: Silence alerts during maintenance
6. **Dedup and Group**: Correlate related alerts

### Dashboards

1. **Start High-Level**: System overview first, drill down later
2. **Use Templates**: Filter by cluster, region, tenant
3. **Show Context**: Include annotations for deployments
4. **Enable Sharing**: Make dashboards easily shareable
5. **Document Panels**: Add descriptions to complex panels
6. **Keep Updated**: Remove obsolete dashboards

### On-Call

1. **Rotation**: 1-week rotations, no more than 3 weeks/quarter
2. **Handoff**: Document active incidents during handoff
3. **Response Time**: <5 min acknowledgment for P0
4. **Post-Mortems**: Write blameless post-mortems for P0/P1
5. **Continuous Improvement**: Update runbooks after incidents
6. **Work-Life Balance**: Limit out-of-hours pages

---

## Support

- **Documentation**: https://www.heliosdb.com/docs/full/
- **Runbooks**: https://www.heliosdb.com/docs/full/
