File size: 3,695 Bytes
d086025
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
# Monitoring Guide

> Set up comprehensive monitoring for Guts nodes.

## Overview

Guts nodes expose Prometheus metrics that can be scraped and visualized with Grafana. This guide covers setting up a complete monitoring stack.

## Metrics Endpoint

By default, metrics are exposed at `http://localhost:9090/metrics`:


## Available Metrics

### HTTP Metrics

| Metric | Type | Description |
|--------|------|-------------|
| `guts_http_requests_total` | Counter | Total HTTP requests by method, path, status |
| `guts_http_request_duration_seconds` | Histogram | Request latency distribution |
| `guts_http_requests_in_flight` | Gauge | Currently processing requests |
| `guts_http_request_size_bytes` | Histogram | Request body size |
| `guts_http_response_size_bytes` | Histogram | Response body size |

### P2P Metrics

| Metric | Type | Description |
|--------|------|-------------|
| `guts_p2p_peers_connected` | Gauge | Number of connected peers |
| `guts_p2p_messages_sent_total` | Counter | Messages sent by type |
| `guts_p2p_messages_received_total` | Counter | Messages received by type |
| `guts_p2p_message_latency_seconds` | Histogram | P2P message latency |
| `guts_p2p_bytes_sent_total` | Counter | Bytes sent |
| `guts_p2p_bytes_received_total` | Counter | Bytes received |

### Storage Metrics

| Metric | Type | Description |
|--------|------|-------------|
| `guts_storage_objects_total` | Gauge | Objects by type (blob, tree, commit) |
| `guts_storage_size_bytes` | Gauge | Total storage size |
| `guts_storage_operation_duration_seconds` | Histogram | Storage operation latency |
| `guts_storage_cache_hits_total` | Counter | Cache hits |
| `guts_storage_cache_misses_total` | Counter | Cache misses |

### Consensus Metrics

| Metric | Type | Description |
|--------|------|-------------|
| `guts_consensus_block_height` | Gauge | Current block height |
| `guts_consensus_validators_total` | Gauge | Number of validators |
| `guts_consensus_commits_total` | Counter | Total committed blocks |
| `guts_consensus_proposals_total` | Counter | Blocks proposed |
| `guts_consensus_round` | Gauge | Current consensus round |
| `guts_consensus_mempool_size` | Gauge | Pending transactions |

### Business Metrics

| Metric | Type | Description |
|--------|------|-------------|
| `guts_repositories_total` | Gauge | Total repositories |
| `guts_pull_requests_total` | Gauge | PRs by state |
| `guts_issues_total` | Gauge | Issues by state |
| `guts_organizations_total` | Gauge | Organizations |
| `guts_users_total` | Gauge | Registered users |

## Prometheus Setup

### Configuration

Create `prometheus.yml`:


### Docker Compose


### Kubernetes (Prometheus Operator)


## Grafana Dashboards

### Dashboard: Node Overview

Import this dashboard for a quick node health overview:


### Dashboard: Consensus Health

For validator networks:


## Key Queries

### Request Performance


### P2P Health


### Consensus Health


### Storage Health


## SLO/SLI Definitions

### Service Level Indicators

| SLI | Target | Query |
|-----|--------|-------|
| Availability | 99.9% | `avg_over_time(up{job="guts-node"}[30d])` |
| Latency (p99) | < 100ms | `histogram_quantile(0.99, rate(guts_http_request_duration_seconds_bucket[5m]))` |
| Error Rate | < 0.1% | `sum(rate(guts_http_requests_total{status=~"5.."}[5m])) / sum(rate(guts_http_requests_total[5m]))` |
| Sync Lag | < 1 min | `time() - guts_last_block_time` |

### Recording Rules


## Troubleshooting Metrics

### No Metrics Appearing


### High Cardinality


### Prometheus Storage


## Related Documentation

- [Alert Configuration](alerting.md)
- [Logging Guide](logging.md)
- [Metrics Reference](../reference/metrics.md)