From 208ea60836cfc98857cf3359a73d8874ed5d935a Mon Sep 17 00:00:00 2001 From: DanConwayDev Date: Fri, 9 Jan 2026 14:23:44 +0000 Subject: refactor(sync): rename ConnectedDegraded to ConnectedHistoricSyncFailures MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- src/sync/metrics.rs | 6 +++--- src/sync/mod.rs | 12 ++++++------ 2 files changed, 9 insertions(+), 9 deletions(-) (limited to 'src/sync') 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 { let relay_connected = IntGaugeVec::new( Opts::new( "ngit_sync_relay_connected", - "Relay connection status (0=disconnected, 1=connecting, 2=syncing, 3=connected, 4=connected_degraded)", + "Relay connection status (0=disconnected, 1=connecting, 2=syncing, 3=connected, 4=connected_historic_sync_failures)", ), &["relay"], )?; @@ -208,7 +208,7 @@ impl SyncMetrics { /// - Connecting = 1 (connection attempt in progress) /// - Syncing = 2 (connected, historic sync in progress) /// - Connected = 3 (connected, historic sync complete) - /// - ConnectedDegraded = 4 (connected, historic sync failed but live sync active) + /// - ConnectedHistoricSyncFailures = 4 (connected, historic sync had failures but live sync active) /// /// This is separate from health state and provides more granular connection lifecycle tracking. /// @@ -223,7 +223,7 @@ impl SyncMetrics { ConnectionStatus::Connecting => 1, ConnectionStatus::Syncing => 2, ConnectionStatus::Connected => 3, - ConnectionStatus::ConnectedDegraded => 4, + ConnectionStatus::ConnectedHistoricSyncFailures => 4, }; self.relay_connected .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 { Syncing, /// Successfully connected, historic sync completed Connected, - /// Successfully connected, historic sync failed but live sync active - ConnectedDegraded, + /// Successfully connected, historic sync had failures but live sync active + ConnectedHistoricSyncFailures, } impl ConnectionStatus { @@ -103,7 +103,7 @@ impl ConnectionStatus { pub fn is_live_sync_active(&self) -> bool { matches!( self, - ConnectionStatus::Syncing | ConnectionStatus::Connected | ConnectionStatus::ConnectedDegraded + ConnectionStatus::Syncing | ConnectionStatus::Connected | ConnectionStatus::ConnectedHistoricSyncFailures ) } } @@ -877,7 +877,7 @@ impl SyncManager { tracing::warn!( relay = %relay_url, batch_id = batch_id, - "Batch failed - will transition to ConnectedDegraded instead of Connected" + "Batch failed - will transition to ConnectedHistoricSyncFailures instead of Connected" ); } @@ -963,7 +963,7 @@ impl SyncManager { if state.connection_status == ConnectionStatus::Syncing { // Check if any batches failed during historic sync let new_status = if state.historic_sync_had_failures { - ConnectionStatus::ConnectedDegraded + ConnectionStatus::ConnectedHistoricSyncFailures } else { ConnectionStatus::Connected }; @@ -979,7 +979,7 @@ impl SyncManager { had_failures = state.historic_sync_had_failures, status = ?new_status, "Historic sync complete - transitioned to {} status", - if state.historic_sync_had_failures { "ConnectedDegraded" } else { "Connected" } + if state.historic_sync_had_failures { "ConnectedHistoricSyncFailures" } else { "Connected" } ); // Update metrics -- cgit v1.2.3