diff options
| author | DanConwayDev <DanConwayDev@protonmail.com> | 2026-01-09 14:23:44 +0000 |
|---|---|---|
| committer | DanConwayDev <DanConwayDev@protonmail.com> | 2026-01-09 14:23:44 +0000 |
| commit | 208ea60836cfc98857cf3359a73d8874ed5d935a (patch) | |
| tree | e653189912f8e749170ef6645a85f9d6c907b3e6 /src | |
| parent | 93a1684f068603b354ba3c05957a25459c73de05 (diff) | |
refactor(sync): rename ConnectedDegraded to ConnectedHistoricSyncFailures
Resolves naming conflict with RelayHealthState::Degraded by using a more
explicit name that clearly indicates the connection status relates to
historic sync failures, not connection health degradation.
Changes:
- ConnectionStatus::ConnectedDegraded → ConnectedHistoricSyncFailures
- Updated all documentation and comments
- Updated Prometheus metric descriptions
- Metric value remains 4 for backward compatibility
This makes it clear that:
- ConnectedHistoricSyncFailures = connection lifecycle (missing historic data)
- RelayHealthState::Degraded = connection health (reliability issues)
These are orthogonal concerns - a relay can be ConnectedHistoricSyncFailures
but Healthy, or Connected but Degraded.
Diffstat (limited to 'src')
| -rw-r--r-- | src/sync/metrics.rs | 6 | ||||
| -rw-r--r-- | src/sync/mod.rs | 12 |
2 files changed, 9 insertions, 9 deletions
diff --git a/src/sync/metrics.rs b/src/sync/metrics.rs index 0f56911..7907d8e 100644 --- a/src/sync/metrics.rs +++ b/src/sync/metrics.rs | |||
| @@ -53,7 +53,7 @@ impl SyncMetrics { | |||
| 53 | let relay_connected = IntGaugeVec::new( | 53 | let relay_connected = IntGaugeVec::new( |
| 54 | Opts::new( | 54 | Opts::new( |
| 55 | "ngit_sync_relay_connected", | 55 | "ngit_sync_relay_connected", |
| 56 | "Relay connection status (0=disconnected, 1=connecting, 2=syncing, 3=connected, 4=connected_degraded)", | 56 | "Relay connection status (0=disconnected, 1=connecting, 2=syncing, 3=connected, 4=connected_historic_sync_failures)", |
| 57 | ), | 57 | ), |
| 58 | &["relay"], | 58 | &["relay"], |
| 59 | )?; | 59 | )?; |
| @@ -208,7 +208,7 @@ impl SyncMetrics { | |||
| 208 | /// - Connecting = 1 (connection attempt in progress) | 208 | /// - Connecting = 1 (connection attempt in progress) |
| 209 | /// - Syncing = 2 (connected, historic sync in progress) | 209 | /// - Syncing = 2 (connected, historic sync in progress) |
| 210 | /// - Connected = 3 (connected, historic sync complete) | 210 | /// - Connected = 3 (connected, historic sync complete) |
| 211 | /// - ConnectedDegraded = 4 (connected, historic sync failed but live sync active) | 211 | /// - ConnectedHistoricSyncFailures = 4 (connected, historic sync had failures but live sync active) |
| 212 | /// | 212 | /// |
| 213 | /// This is separate from health state and provides more granular connection lifecycle tracking. | 213 | /// This is separate from health state and provides more granular connection lifecycle tracking. |
| 214 | /// | 214 | /// |
| @@ -223,7 +223,7 @@ impl SyncMetrics { | |||
| 223 | ConnectionStatus::Connecting => 1, | 223 | ConnectionStatus::Connecting => 1, |
| 224 | ConnectionStatus::Syncing => 2, | 224 | ConnectionStatus::Syncing => 2, |
| 225 | ConnectionStatus::Connected => 3, | 225 | ConnectionStatus::Connected => 3, |
| 226 | ConnectionStatus::ConnectedDegraded => 4, | 226 | ConnectionStatus::ConnectedHistoricSyncFailures => 4, |
| 227 | }; | 227 | }; |
| 228 | self.relay_connected | 228 | self.relay_connected |
| 229 | .with_label_values(&[relay]) | 229 | .with_label_values(&[relay]) |
diff --git a/src/sync/mod.rs b/src/sync/mod.rs index 2031ef4..0e5b9bb 100644 --- a/src/sync/mod.rs +++ b/src/sync/mod.rs | |||
| @@ -94,8 +94,8 @@ pub enum ConnectionStatus { | |||
| 94 | Syncing, | 94 | Syncing, |
| 95 | /// Successfully connected, historic sync completed | 95 | /// Successfully connected, historic sync completed |
| 96 | Connected, | 96 | Connected, |
| 97 | /// Successfully connected, historic sync failed but live sync active | 97 | /// Successfully connected, historic sync had failures but live sync active |
| 98 | ConnectedDegraded, | 98 | ConnectedHistoricSyncFailures, |
| 99 | } | 99 | } |
| 100 | 100 | ||
| 101 | impl ConnectionStatus { | 101 | impl ConnectionStatus { |
| @@ -103,7 +103,7 @@ impl ConnectionStatus { | |||
| 103 | pub fn is_live_sync_active(&self) -> bool { | 103 | pub fn is_live_sync_active(&self) -> bool { |
| 104 | matches!( | 104 | matches!( |
| 105 | self, | 105 | self, |
| 106 | ConnectionStatus::Syncing | ConnectionStatus::Connected | ConnectionStatus::ConnectedDegraded | 106 | ConnectionStatus::Syncing | ConnectionStatus::Connected | ConnectionStatus::ConnectedHistoricSyncFailures |
| 107 | ) | 107 | ) |
| 108 | } | 108 | } |
| 109 | } | 109 | } |
| @@ -877,7 +877,7 @@ impl SyncManager { | |||
| 877 | tracing::warn!( | 877 | tracing::warn!( |
| 878 | relay = %relay_url, | 878 | relay = %relay_url, |
| 879 | batch_id = batch_id, | 879 | batch_id = batch_id, |
| 880 | "Batch failed - will transition to ConnectedDegraded instead of Connected" | 880 | "Batch failed - will transition to ConnectedHistoricSyncFailures instead of Connected" |
| 881 | ); | 881 | ); |
| 882 | } | 882 | } |
| 883 | 883 | ||
| @@ -963,7 +963,7 @@ impl SyncManager { | |||
| 963 | if state.connection_status == ConnectionStatus::Syncing { | 963 | if state.connection_status == ConnectionStatus::Syncing { |
| 964 | // Check if any batches failed during historic sync | 964 | // Check if any batches failed during historic sync |
| 965 | let new_status = if state.historic_sync_had_failures { | 965 | let new_status = if state.historic_sync_had_failures { |
| 966 | ConnectionStatus::ConnectedDegraded | 966 | ConnectionStatus::ConnectedHistoricSyncFailures |
| 967 | } else { | 967 | } else { |
| 968 | ConnectionStatus::Connected | 968 | ConnectionStatus::Connected |
| 969 | }; | 969 | }; |
| @@ -979,7 +979,7 @@ impl SyncManager { | |||
| 979 | had_failures = state.historic_sync_had_failures, | 979 | had_failures = state.historic_sync_had_failures, |
| 980 | status = ?new_status, | 980 | status = ?new_status, |
| 981 | "Historic sync complete - transitioned to {} status", | 981 | "Historic sync complete - transitioned to {} status", |
| 982 | if state.historic_sync_had_failures { "ConnectedDegraded" } else { "Connected" } | 982 | if state.historic_sync_had_failures { "ConnectedHistoricSyncFailures" } else { "Connected" } |
| 983 | ); | 983 | ); |
| 984 | 984 | ||
| 985 | // Update metrics | 985 | // Update metrics |