|
| 1 | +# Geth Engine Metrics Documentation |
| 2 | + |
| 3 | +This document describes the metrics exposed by the Geth engine and monitored in the Grafana dashboard. |
| 4 | + |
| 5 | +## Overview |
| 6 | + |
| 7 | +The Geth engine exposes Prometheus-format metrics that provide insights into system performance, I/O operations, and resource utilization. These metrics are organized into several categories for comprehensive monitoring. |
| 8 | + |
| 9 | +## System Resource Metrics |
| 10 | + |
| 11 | +### CPU Metrics |
| 12 | + |
| 13 | +| Metric Name | Type | Description | |
| 14 | +|-------------|------|-------------| |
| 15 | +| `geth_sys_cpu_usage_percent` | Gauge | Current CPU usage as a percentage (0-100). Indicates how much CPU resources the Geth engine is consuming. | |
| 16 | + |
| 17 | +**Usage**: Monitor for high CPU usage that might indicate performance bottlenecks or heavy computational load. |
| 18 | + |
| 19 | +### Memory Metrics |
| 20 | + |
| 21 | +| Metric Name | Type | Description | |
| 22 | +|-------------|------|-------------| |
| 23 | +| `geth_sys_memory_total_bytes` | Gauge | Total system memory available in bytes. This represents the total RAM capacity of the system. | |
| 24 | +| `geth_sys_memory_used_bytes` | Gauge | Currently used system memory in bytes. Shows how much RAM is being utilized. | |
| 25 | + |
| 26 | +**Usage**: Calculate memory usage percentage and monitor for memory pressure or potential out-of-memory conditions. |
| 27 | + |
| 28 | +### Swap Metrics |
| 29 | + |
| 30 | +| Metric Name | Type | Description | |
| 31 | +|-------------|------|-------------| |
| 32 | +| `geth_sys_swap_total_bytes` | Gauge | Total swap space available in bytes. Represents the disk space allocated for virtual memory. | |
| 33 | +| `geth_sys_swap_used_bytes` | Gauge | Currently used swap space in bytes. Shows how much swap is being utilized. | |
| 34 | + |
| 35 | +**Usage**: Monitor swap usage to detect memory pressure. High swap usage indicates the system is running low on physical memory. |
| 36 | + |
| 37 | +## I/O Operation Metrics |
| 38 | + |
| 39 | +### Read Operations |
| 40 | + |
| 41 | +| Metric Name | Type | Description | |
| 42 | +|-------------|------|-------------| |
| 43 | +| `geth_read_entry_entries_total` | Counter | Total number of read entries processed since startup. Continuously increments with each read operation. | |
| 44 | + |
| 45 | +**Usage**: Track read operation volume and calculate read rates using `rate()` function. |
| 46 | + |
| 47 | +### Write Operations |
| 48 | + |
| 49 | +| Metric Name | Type | Description | |
| 50 | +|-------------|------|-------------| |
| 51 | +| `geth_write_propose_event_events_total` | Counter | Total number of write propose events processed since startup. Tracks write operation frequency. | |
| 52 | + |
| 53 | +**Usage**: Monitor write operation volume and calculate write rates to understand database activity. |
| 54 | + |
| 55 | +### Cache Performance |
| 56 | + |
| 57 | +| Metric Name | Type | Description | |
| 58 | +|-------------|------|-------------| |
| 59 | +| `geth_index_cache_miss_misses_total` | Counter | Total number of index cache misses since startup. High values indicate poor cache performance. | |
| 60 | + |
| 61 | +**Usage**: Monitor cache efficiency. High miss rates may indicate need for cache tuning or insufficient cache size. |
| 62 | + |
| 63 | +## I/O Size Distribution Metrics |
| 64 | + |
| 65 | +### Read Size Histograms |
| 66 | + |
| 67 | +| Metric Name | Type | Description | |
| 68 | +|-------------|------|-------------| |
| 69 | +| `geth_read_size_bytes_bucket` | Histogram | Distribution of read operation sizes across different byte ranges (buckets). | |
| 70 | +| `geth_read_size_bytes_sum` | Histogram | Total bytes read across all operations. | |
| 71 | +| `geth_read_size_bytes_count` | Histogram | Total number of read operations. | |
| 72 | + |
| 73 | +**Buckets**: 0, 5, 10, 25, 50, 75, 100, 250, 500, 750, 1000, 2500, 5000, 7500, 10000, +Inf |
| 74 | + |
| 75 | +### Write Size Histograms |
| 76 | + |
| 77 | +| Metric Name | Type | Description | |
| 78 | +|-------------|------|-------------| |
| 79 | +| `geth_write_size_bytes_bucket` | Histogram | Distribution of write operation sizes across different byte ranges (buckets). | |
| 80 | +| `geth_write_size_bytes_sum` | Histogram | Total bytes written across all operations. | |
| 81 | +| `geth_write_size_bytes_count` | Histogram | Total number of write operations. | |
| 82 | + |
| 83 | +**Buckets**: 0, 5, 10, 25, 50, 75, 100, 250, 500, 750, 1000, 2500, 5000, 7500, 10000, +Inf |
| 84 | + |
| 85 | +**Usage**: Analyze I/O patterns, calculate percentiles, and understand the distribution of operation sizes to optimize performance. |
| 86 | + |
| 87 | +## Common Metric Calculations |
| 88 | + |
| 89 | +### Rate Calculations |
| 90 | +```promql |
| 91 | +# Read operations per second |
| 92 | +rate(geth_read_entry_entries_total[5m]) |
| 93 | +
|
| 94 | +# Write operations per second |
| 95 | +rate(geth_write_propose_event_events_total[5m]) |
| 96 | +
|
| 97 | +# Cache misses per second |
| 98 | +rate(geth_index_cache_miss_misses_total[5m]) |
| 99 | +``` |
| 100 | + |
| 101 | +### Memory Usage Percentage |
| 102 | +```promql |
| 103 | +# Memory usage as percentage |
| 104 | +geth_sys_memory_used_bytes / geth_sys_memory_total_bytes * 100 |
| 105 | +``` |
| 106 | + |
| 107 | +### Average I/O Sizes |
| 108 | +```promql |
| 109 | +# Average read size |
| 110 | +rate(geth_read_size_bytes_sum[5m]) / rate(geth_read_size_bytes_count[5m]) |
| 111 | +
|
| 112 | +# Average write size |
| 113 | +rate(geth_write_size_bytes_sum[5m]) / rate(geth_write_size_bytes_count[5m]) |
| 114 | +``` |
| 115 | + |
| 116 | +### I/O Throughput |
| 117 | +```promql |
| 118 | +# Read throughput (bytes per second) |
| 119 | +rate(geth_read_size_bytes_sum[5m]) |
| 120 | +
|
| 121 | +# Write throughput (bytes per second) |
| 122 | +rate(geth_write_size_bytes_sum[5m]) |
| 123 | +``` |
| 124 | + |
| 125 | +### Percentile Analysis |
| 126 | +```promql |
| 127 | +# 90th percentile read size |
| 128 | +histogram_quantile(0.90, rate(geth_read_size_bytes_bucket[5m])) |
| 129 | +
|
| 130 | +# 99th percentile write size |
| 131 | +histogram_quantile(0.99, rate(geth_write_size_bytes_bucket[5m])) |
| 132 | +``` |
| 133 | + |
| 134 | +## Alerting Recommendations |
| 135 | + |
| 136 | +### Critical Alerts |
| 137 | +- **High CPU Usage**: `geth_sys_cpu_usage_percent > 90` |
| 138 | +- **High Memory Usage**: `(geth_sys_memory_used_bytes / geth_sys_memory_total_bytes) * 100 > 90` |
| 139 | +- **Swap Usage**: `geth_sys_swap_used_bytes > 0` (any swap usage may indicate memory pressure) |
| 140 | + |
| 141 | +### Warning Alerts |
| 142 | +- **Moderate CPU Usage**: `geth_sys_cpu_usage_percent > 70` |
| 143 | +- **Moderate Memory Usage**: `(geth_sys_memory_used_bytes / geth_sys_memory_total_bytes) * 100 > 70` |
| 144 | +- **High Cache Miss Rate**: `rate(geth_index_cache_miss_misses_total[5m]) > threshold` |
| 145 | + |
| 146 | +## Dashboard Panels |
| 147 | + |
| 148 | +The Grafana dashboard includes the following visualization panels: |
| 149 | + |
| 150 | +1. **System Overview**: CPU usage, memory usage, memory details, swap usage |
| 151 | +2. **I/O Operations**: Read/write operation rates, cache miss rate |
| 152 | +3. **I/O Size Analysis**: Read/write size distributions with percentiles |
| 153 | +4. **Summary Stats**: Total operation counters, system resource timeline |
| 154 | + |
| 155 | +## Troubleshooting |
| 156 | + |
| 157 | +### No Data in Panels |
| 158 | +- Verify Prometheus is scraping the Geth metrics endpoint |
| 159 | +- Check that metric names match exactly (case-sensitive) |
| 160 | +- Ensure time range covers period when metrics were generated |
| 161 | +- Confirm Prometheus datasource is configured correctly |
| 162 | + |
| 163 | +### High Resource Usage |
| 164 | +- Check CPU and memory trends over time |
| 165 | +- Analyze I/O patterns for unusual spikes |
| 166 | +- Review cache performance metrics |
| 167 | +- Consider scaling resources if sustained high usage |
| 168 | + |
| 169 | +### Performance Issues |
| 170 | +- Monitor I/O operation rates and sizes |
| 171 | +- Check for large operations that might cause bottlenecks |
| 172 | +- Analyze cache miss patterns |
| 173 | +- Review histogram data for operation size distribution |
| 174 | + |
| 175 | +## Metric Labels |
| 176 | + |
| 177 | +All metrics include the following labels: |
| 178 | +- `job`: "geth-engine" |
| 179 | +- `otel_scope_name`: "geth-engine" |
| 180 | +- `otel_scope_schema_url`: "" |
| 181 | +- `otel_scope_version`: "" |
| 182 | + |
| 183 | +These labels can be used for filtering and aggregation in Prometheus queries. |
0 commit comments