Skip to content

Commit bfb8d8a

Browse files
authored
Add monitoring, alerting, and on-call runbook for Wraith Protocol ops (#142)
- Created comprehensive guides/ops/monitoring-and-on-call.mdx with: * Key metrics for RPC, indexer, contracts, and watcher * Healthy baselines and alert thresholds * Six incident playbooks with diagnosis and mitigation steps * Severity matrix mapped to Auditor Guide * Quarterly tabletop exercise script - Added Grafana dashboards in guides/ops/dashboards/: * rpc-health.json - RPC latency, error rates, backpressure * indexer-performance.json - announcement lag, backlog, sync height * contract-monitoring.json - contract errors, invocation latency - Added Prometheus alerting rules in guides/ops/alerts/: * wraith-alerts.yml with 20+ production-ready rules * Rationale and runbook links per alert * Severity labels mapped to SLA requirements - Updated docs.json with Operations nav entry - Cross-linked with self-hosted-deployment.mdx and auditor-guide.mdx Resolves #133
1 parent 9bb0cae commit bfb8d8a

7 files changed

Lines changed: 1716 additions & 1 deletion

File tree

docs.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,8 @@
171171
"guides/stellar/stellar-quickstart",
172172
"guides/stellar/wraith-names-lifecycle",
173173
"guides/wraith-names-stellar",
174-
"guides/ops/self-hosted-deployment"
174+
"guides/ops/self-hosted-deployment",
175+
"guides/ops/monitoring-and-on-call"
175176
]
176177
}
177178
]
Lines changed: 274 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,274 @@
1+
groups:
2+
- name: wraith_rpc_alerts
3+
interval: 30s
4+
rules:
5+
- alert: HighRPCLatency
6+
expr: histogram_quantile(0.95, sum(rate(wraith_rpc_latency_seconds_bucket[5m])) by (le, method)) > 2
7+
for: 5m
8+
labels:
9+
severity: high
10+
component: rpc
11+
team: platform
12+
annotations:
13+
summary: "RPC P95 latency > 2s for 5 minutes"
14+
description: "{{ $labels.method }} RPC calls are experiencing high latency ({{ $value }}s). Check Horizon/Soroban RPC health and network connectivity."
15+
playbook: "https://docs.usewraith.xyz/guides/ops/monitoring-and-on-call#playbook-1-rpc-outage"
16+
dashboard: "https://grafana.example.com/d/wraith-rpc-health"
17+
runbook_steps: |
18+
1. Check RPC endpoint status
19+
2. Verify network connectivity
20+
3. Switch to backup RPC if available
21+
4. Enable request queueing
22+
23+
- alert: HighRPCErrorRate
24+
expr: sum(rate(wraith_rpc_error_rate[5m])) / sum(rate(wraith_rpc_latency_seconds_count[5m])) > 0.05
25+
for: 2m
26+
labels:
27+
severity: critical
28+
component: rpc
29+
team: platform
30+
annotations:
31+
summary: "RPC error rate > 5%"
32+
description: "{{ $value | humanizePercentage }} of RPC calls are failing. Immediate investigation required."
33+
playbook: "https://docs.usewraith.xyz/guides/ops/monitoring-and-on-call#playbook-1-rpc-outage"
34+
35+
- alert: HorizonBackpressure
36+
expr: rate(wraith_horizon_backpressure[1m]) > 10
37+
for: 2m
38+
labels:
39+
severity: critical
40+
component: rpc
41+
team: platform
42+
page: "true"
43+
annotations:
44+
summary: "Horizon rate-limiting detected (> 10 429s/min)"
45+
description: "Application is being rate-limited by Horizon at {{ $value }} 429 responses/min. Immediate intervention required to prevent service disruption."
46+
playbook: "https://docs.usewraith.xyz/guides/ops/monitoring-and-on-call#playbook-2-horizon-backpressure"
47+
impact: "Users cannot submit transactions. Service degraded."
48+
49+
- alert: SorobanInvocationFailures
50+
expr: rate(wraith_soroban_invocation_failures[1h]) > 5
51+
for: 5m
52+
labels:
53+
severity: high
54+
component: rpc
55+
team: platform
56+
annotations:
57+
summary: "Soroban invocation failure rate high"
58+
description: "{{ $value }} Soroban invocations failed in the last hour due to RPC issues."
59+
playbook: "https://docs.usewraith.xyz/guides/ops/monitoring-and-on-call#playbook-1-rpc-outage"
60+
61+
- name: wraith_indexer_alerts
62+
interval: 1m
63+
rules:
64+
- alert: IndexerBacklogBuildup
65+
expr: wraith_indexer_backlog_count > 1000
66+
for: 5m
67+
labels:
68+
severity: high
69+
component: indexer
70+
team: data
71+
annotations:
72+
summary: "Indexer backlog > 1000 announcements"
73+
description: "Indexer is falling behind with {{ $value }} unprocessed announcements. Check database performance and announcement ingestion rate."
74+
playbook: "https://docs.usewraith.xyz/guides/ops/monitoring-and-on-call#playbook-3-indexer-stall"
75+
dashboard: "https://grafana.example.com/d/wraith-indexer-performance"
76+
impact: "Users may experience delayed stealth payment notifications."
77+
78+
- alert: AnnouncementLagHigh
79+
expr: wraith_announcement_lag_seconds > 300
80+
for: 5m
81+
labels:
82+
severity: medium
83+
component: indexer
84+
team: data
85+
annotations:
86+
summary: "Announcement lag > 5 minutes"
87+
description: "Time between announcement emission and indexing is {{ $value }}s. Users may experience delays seeing incoming stealth payments."
88+
playbook: "https://docs.usewraith.xyz/guides/ops/monitoring-and-on-call#playbook-3-indexer-stall"
89+
90+
- alert: IndexerSyncHeightLagging
91+
expr: (stellar_network_ledger_height - wraith_indexer_sync_height) > 50
92+
for: 10m
93+
labels:
94+
severity: high
95+
component: indexer
96+
team: data
97+
annotations:
98+
summary: "Indexer sync height lagging by > 50 ledgers"
99+
description: "Indexer is {{ $value }} ledgers behind the network tip. Risk of announcement processing delays."
100+
playbook: "https://docs.usewraith.xyz/guides/ops/monitoring-and-on-call#playbook-3-indexer-stall"
101+
102+
- alert: ScanMissRateHigh
103+
expr: rate(wraith_scan_miss_rate[10m]) > 0.05
104+
for: 10m
105+
labels:
106+
severity: medium
107+
component: indexer
108+
team: data
109+
annotations:
110+
summary: "View-tag scan miss rate > 5%"
111+
description: "{{ $value | humanizePercentage }} of scanned announcements are not matching. Check view-tag scanner configuration."
112+
playbook: "https://docs.usewraith.xyz/guides/ops/monitoring-and-on-call#playbook-3-indexer-stall"
113+
114+
- name: wraith_contract_alerts
115+
interval: 1m
116+
rules:
117+
- alert: ContractErrorRateHigh
118+
expr: sum(rate(wraith_contract_error_rate[5m])) by (contract) > 0.01
119+
for: 5m
120+
labels:
121+
severity: critical
122+
component: contracts
123+
team: blockchain
124+
page: "true"
125+
annotations:
126+
summary: "Contract {{ $labels.contract }} error rate > 1%"
127+
description: "Contract {{ $labels.contract }} invocations are failing at {{ $value | humanizePercentage }}. Check contract state, RPC health, and recent deployments."
128+
playbook: "https://docs.usewraith.xyz/guides/ops/monitoring-and-on-call#playbook-4-contract-mispublish"
129+
dashboard: "https://grafana.example.com/d/wraith-contract-monitoring"
130+
impact: "Core Wraith functionality may be unavailable to users."
131+
132+
- alert: SenderInvocationLatencyHigh
133+
expr: histogram_quantile(0.95, sum(rate(wraith_sender_invocation_latency_seconds_bucket[5m])) by (le)) > 20
134+
for: 5m
135+
labels:
136+
severity: high
137+
component: contracts
138+
team: blockchain
139+
annotations:
140+
summary: "Sender invocation P95 latency > 20s"
141+
description: "Stealth payment submissions are taking {{ $value }}s at P95. Check RPC performance and network congestion."
142+
playbook: "https://docs.usewraith.xyz/guides/ops/monitoring-and-on-call#playbook-4-contract-mispublish"
143+
144+
- alert: NamesRegistrationFailures
145+
expr: increase(wraith_names_registration_failures[1h]) > 3
146+
for: 5m
147+
labels:
148+
severity: high
149+
component: contracts
150+
team: blockchain
151+
annotations:
152+
summary: "Wraith Names registrations failing"
153+
description: "{{ $value }} wraith-names registration attempts failed in the last hour. Check contract admin authorization and state."
154+
playbook: "https://docs.usewraith.xyz/guides/ops/monitoring-and-on-call#playbook-4-contract-mispublish"
155+
156+
- alert: UnauthorizedAccessAttempt
157+
expr: increase(wraith_unauthorized_access_attempts[5m]) > 0
158+
for: 1m
159+
labels:
160+
severity: critical
161+
component: contracts
162+
team: security
163+
page: "true"
164+
annotations:
165+
summary: "SECURITY: Unauthorized contract access detected"
166+
description: "{{ $value }} unauthorized access attempt(s) detected on Wraith contracts. Potential security incident - investigate immediately."
167+
playbook: "https://docs.usewraith.xyz/guides/ops/monitoring-and-on-call#playbook-6-key-rotation-incident"
168+
impact: "Potential security breach. Admin keys may be compromised."
169+
action_required: "1. Verify contract admin keys. 2. Check transaction history. 3. Initiate key rotation if needed. 4. Notify security team."
170+
171+
- name: wraith_watcher_alerts
172+
interval: 1m
173+
rules:
174+
- alert: WatcherEventDropSpike
175+
expr: rate(wraith_watcher_event_drop_rate[5m]) > 5
176+
for: 2m
177+
labels:
178+
severity: high
179+
component: watcher
180+
team: platform
181+
annotations:
182+
summary: "Watcher event drop rate > 5/hour"
183+
description: "Events are being dropped at {{ $value }}/hour. Users may miss stealth payment notifications."
184+
playbook: "https://docs.usewraith.xyz/guides/ops/monitoring-and-on-call#playbook-5-watcher-drop-spike"
185+
impact: "Users may not see incoming stealth payments in wallets."
186+
187+
- alert: ViewTagScanLatencyHigh
188+
expr: histogram_quantile(0.95, rate(wraith_view_tag_scan_duration_seconds_bucket[5m])) > 0.1
189+
for: 10m
190+
labels:
191+
severity: medium
192+
component: watcher
193+
team: platform
194+
annotations:
195+
summary: "View-tag scan P95 latency > 100ms"
196+
description: "View-tag scanning is taking {{ $value }}s at P95. Risk of announcement processing bottleneck."
197+
playbook: "https://docs.usewraith.xyz/guides/ops/monitoring-and-on-call#playbook-5-watcher-drop-spike"
198+
199+
- alert: ViewTagFalsePositiveRateHigh
200+
expr: rate(wraith_view_tag_false_positive_rate[10m]) > 0.1
201+
for: 10m
202+
labels:
203+
severity: low
204+
component: watcher
205+
team: platform
206+
annotations:
207+
summary: "View-tag false positive rate > 10%"
208+
description: "{{ $value | humanizePercentage }} of view-tag matches are failing full ECDH check. Consider view-tag configuration review."
209+
playbook: "https://docs.usewraith.xyz/guides/ops/monitoring-and-on-call#playbook-5-watcher-drop-spike"
210+
211+
- alert: WatcherDown
212+
expr: up{job="wraith-watcher"} == 0
213+
for: 2m
214+
labels:
215+
severity: critical
216+
component: watcher
217+
team: platform
218+
page: "true"
219+
annotations:
220+
summary: "Watcher service is DOWN"
221+
description: "Watcher process is not responding. All event monitoring is offline."
222+
playbook: "https://docs.usewraith.xyz/guides/ops/monitoring-and-on-call#playbook-5-watcher-drop-spike"
223+
impact: "NO stealth payment events are being processed. Service is effectively down for users."
224+
action_required: "Restart watcher service immediately."
225+
226+
- name: wraith_meta_alerts
227+
interval: 5m
228+
rules:
229+
- alert: TooManyFiringAlerts
230+
expr: count(ALERTS{alertstate="firing", severity=~"critical|high"}) > 5
231+
for: 5m
232+
labels:
233+
severity: critical
234+
component: meta
235+
team: sre
236+
page: "true"
237+
annotations:
238+
summary: "Multiple critical/high alerts firing simultaneously"
239+
description: "{{ $value }} critical or high severity alerts are firing. Potential cascading failure or infrastructure issue."
240+
action_required: "Escalate to incident commander. Begin coordinated multi-team response."
241+
242+
- alert: AlertmanagerDown
243+
expr: up{job="alertmanager"} == 0
244+
for: 5m
245+
labels:
246+
severity: critical
247+
component: monitoring
248+
team: sre
249+
annotations:
250+
summary: "Alertmanager is DOWN"
251+
description: "Alertmanager process is not responding. Alert routing is offline."
252+
impact: "No alerts are being delivered to on-call engineers."
253+
254+
# Rationale per rule:
255+
#
256+
# RPC Alerts:
257+
# - HighRPCLatency: Slow RPC degrades UX and can cause transaction timeouts. 2s threshold based on typical Stellar finality.
258+
# - HorizonBackpressure: 429 rate limiting is critical - service is effectively down if sustained.
259+
# - SorobanInvocationFailures: Contract calls failing means core Wraith features unavailable.
260+
#
261+
# Indexer Alerts:
262+
# - IndexerBacklogBuildup: Large backlog means users won't see payments promptly. 1000 is ~10min at 100 announcements/min.
263+
# - AnnouncementLagHigh: 5min lag is poor UX for real-time payment notifications.
264+
# - ScanMissRateHigh: High miss rate suggests view-tag misconfiguration or scanning bugs.
265+
#
266+
# Contract Alerts:
267+
# - ContractErrorRateHigh: Any sustained contract error rate is critical - means core protocol broken.
268+
# - UnauthorizedAccessAttempt: Security incident - requires immediate response per auditor guide severity matrix.
269+
#
270+
# Watcher Alerts:
271+
# - WatcherEventDropSpike: Dropped events = missed payments = broken core functionality.
272+
# - ViewTagScanLatencyHigh: Slow scanning causes backlog and eventual drops.
273+
#
274+
# All thresholds tuned to balance false positives vs. catching real incidents early.

0 commit comments

Comments
 (0)