diff --git a/relay-dynamic-config/src/global.rs b/relay-dynamic-config/src/global.rs index f8f850f1d17..40a63e6931b 100644 --- a/relay-dynamic-config/src/global.rs +++ b/relay-dynamic-config/src/global.rs @@ -97,6 +97,12 @@ fn is_err_or_empty(filters_config: &ErrorBoundary) -> bool } } +// Temporary until we understand why we see false killswitch values sometimes appearing. +fn default_killswitched() -> bool { + relay_log::info!("using default for endpoint fetch config"); + bool::default() +} + /// All options passed down from Sentry to Relay. #[derive(Default, Clone, Debug, Serialize, Deserialize, PartialEq)] #[serde(default)] @@ -172,6 +178,7 @@ pub struct Options { /// Kill-switch for fetching project configs in endpoints. #[serde( + default = "default_killswitched", rename = "relay.endpoint-fetch-config.enabled", deserialize_with = "default_on_error", skip_serializing_if = "is_default" diff --git a/relay-server/src/endpoints/minidump.rs b/relay-server/src/endpoints/minidump.rs index 42c83920d0f..ce67264ecb8 100644 --- a/relay-server/src/endpoints/minidump.rs +++ b/relay-server/src/endpoints/minidump.rs @@ -415,6 +415,7 @@ async fn upload_context<'a>( if !state .global_config_handle() .current() + .unwrap_or_default() .options .endpoint_fetch_config_enabled { diff --git a/relay-server/src/endpoints/playstation.rs b/relay-server/src/endpoints/playstation.rs index 366603c049c..174e2e10067 100644 --- a/relay-server/src/endpoints/playstation.rs +++ b/relay-server/src/endpoints/playstation.rs @@ -77,6 +77,7 @@ async fn upload_context<'a>( if !state .global_config_handle() .current() + .unwrap_or_default() .options .endpoint_fetch_config_enabled { diff --git a/relay-server/src/endpoints/unreal.rs b/relay-server/src/endpoints/unreal.rs index f30a6a6b465..e983492a7ee 100644 --- a/relay-server/src/endpoints/unreal.rs +++ b/relay-server/src/endpoints/unreal.rs @@ -51,7 +51,7 @@ impl UnrealParams { envelope.set_header(UNREAL_USER_HEADER, user_id); } - let global_config = state.global_config_handle().current(); + let global_config = state.global_config_handle().current().unwrap_or_default(); if global_config.options.endpoint_fetch_config_enabled { // Ensure that we really make it here. diff --git a/relay-server/src/endpoints/upload.rs b/relay-server/src/endpoints/upload.rs index dbb377bd013..2b5b7c9df7b 100644 --- a/relay-server/src/endpoints/upload.rs +++ b/relay-server/src/endpoints/upload.rs @@ -267,9 +267,15 @@ fn check_kill_switch(state: &ServiceState) -> Result<(), StatusCode> { if !state.global_config_handle().is_ready() { relay_log::warn!("global config not available"); } + + if state.global_config_handle().current().is_none() { + relay_log::info!("check_kill_switch global config is none"); + } + if !state .global_config_handle() .current() + .unwrap_or_default() .options .endpoint_fetch_config_enabled { diff --git a/relay-server/src/services/global_config.rs b/relay-server/src/services/global_config.rs index 130ec6c3d45..fdbc0fa6cf2 100644 --- a/relay-server/src/services/global_config.rs +++ b/relay-server/src/services/global_config.rs @@ -168,11 +168,11 @@ impl GlobalConfigHandle { /// Returns the currently loaded or a default global config. /// /// When no global config has been received from upstream yet, - /// this will return a default global config. - pub fn current(&self) -> Arc { + /// this will return None. + pub fn current(&self) -> Option> { match &*self.watch.borrow() { - Status::Ready(config) => Arc::clone(config), - Status::Pending => Default::default(), + Status::Ready(config) => Some(Arc::clone(config)), + Status::Pending => None, } } } diff --git a/relay-server/src/services/processor.rs b/relay-server/src/services/processor.rs index bcfb479ead8..b012a653978 100644 --- a/relay-server/src/services/processor.rs +++ b/relay-server/src/services/processor.rs @@ -1346,7 +1346,7 @@ impl EnvelopeProcessorService { ManagedEnvelope::new(envelope, self.inner.addrs.outcome_aggregator.clone()); envelope.scope(scoping); - let global_config = self.inner.global_config.current(); + let global_config = self.inner.global_config.current().unwrap_or_default(); let ctx = processing::Context { config: &self.inner.config, @@ -1687,7 +1687,7 @@ impl EnvelopeProcessorService { return buckets; }; - let global_config = self.inner.global_config.current(); + let global_config = self.inner.global_config.current().unwrap_or_default(); let namespaces = buckets .iter() .filter_map(|bucket| bucket.name.try_namespace()) @@ -1747,7 +1747,7 @@ impl EnvelopeProcessorService { let scoping = *bucket_limiter.scoping(); if let Some(rate_limiter) = self.inner.rate_limiter.as_ref() { - let global_config = self.inner.global_config.current(); + let global_config = self.inner.global_config.current().unwrap_or_default(); let quotas = CombinedQuotas::new(&global_config, bucket_limiter.quotas()); // We set over_accept_once such that the limit is actually reached, which allows subsequent diff --git a/relay-server/src/services/store.rs b/relay-server/src/services/store.rs index 7c789c3d0fb..46704733a78 100644 --- a/relay-server/src/services/store.rs +++ b/relay-server/src/services/store.rs @@ -623,7 +623,7 @@ impl StoreService { let batch_size = self.config.metrics_max_batch_size_bytes(); let mut error = None; - let global_config = self.global_config.current(); + let global_config = self.global_config.current().unwrap_or_default(); let mut encoder = BucketEncoder::new(&global_config); let emit_sessions_to_eap = utils::is_rolled_out( @@ -727,6 +727,7 @@ impl StoreService { scoping.organization_id.value(), self.global_config .current() + .unwrap_or_default() .options .eap_outcomes_rollout_rate, ) @@ -774,6 +775,7 @@ impl StoreService { scoping.organization_id.value(), self.global_config .current() + .unwrap_or_default() .options .eap_span_outcomes_rollout_rate, ) @@ -1303,6 +1305,7 @@ impl StoreService { scoping.organization_id.value(), self.global_config .current() + .unwrap_or_default() .options .eap_span_outcomes_rollout_rate, )