Skip to content

Commit cff8d14

Browse files
feat(relay): Remove static mode (#5108)
This needs to be coordinated with changes in Sentry that make managed mode available to everyone and an updating of the docs telling people managed mode is now available. Sentry PRs: getsentry/sentry#98696 & getsentry/sentry#98688 Docs PR: getsentry/sentry-docs#14787 Ref: https://linear.app/getsentry/issue/INGEST-545/update-relay --------- Co-authored-by: Joris Bayer <[email protected]>
1 parent 615295a commit cff8d14

File tree

12 files changed

+31
-527
lines changed

12 files changed

+31
-527
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
**Breaking Changes**:
66

77
- Removes support for the deprecated and early alpha only otel log item type. ([#5082](https://github.com/getsentry/relay/pull/5082))
8-
- Only check for local project configs in static mode. ([#5057](https://github.com/getsentry/relay/pull/5057))
8+
- Remove static mode. ([#5108](https://github.com/getsentry/relay/pull/5108))
99

1010
**Features**:
1111

relay-config/src/config.rs

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ impl RelayInfo {
324324
}
325325

326326
/// The operation mode of a relay.
327-
#[derive(Clone, Copy, Debug, Eq, PartialEq, Deserialize, Serialize)]
327+
#[derive(Clone, Copy, Debug, Eq, PartialEq, Serialize)]
328328
#[serde(rename_all = "camelCase")]
329329
pub enum RelayMode {
330330
/// This relay acts as a proxy for all requests and events.
@@ -334,12 +334,6 @@ pub enum RelayMode {
334334
/// accepted unless overridden on the file system.
335335
Proxy,
336336

337-
/// This relay is configured statically in the file system.
338-
///
339-
/// Events are only accepted for projects configured statically in the file system. All other
340-
/// events are rejected. If configured, PII stripping is also performed on those events.
341-
Static,
342-
343337
/// Project configurations are managed by the upstream.
344338
///
345339
/// Project configurations are always fetched from the upstream, unless they are statically
@@ -348,11 +342,30 @@ pub enum RelayMode {
348342
Managed,
349343
}
350344

345+
impl<'de> Deserialize<'de> for RelayMode {
346+
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
347+
where
348+
D: Deserializer<'de>,
349+
{
350+
let s = String::deserialize(deserializer)?;
351+
match s.as_str() {
352+
"proxy" => Ok(RelayMode::Proxy),
353+
"managed" => Ok(RelayMode::Managed),
354+
"static" => Err(serde::de::Error::custom(
355+
"Relay mode 'static' has been removed. Please use 'managed' or 'proxy' instead.",
356+
)),
357+
other => Err(serde::de::Error::unknown_variant(
358+
other,
359+
&["proxy", "managed"],
360+
)),
361+
}
362+
}
363+
}
364+
351365
impl fmt::Display for RelayMode {
352366
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
353367
match self {
354368
RelayMode::Proxy => write!(f, "proxy"),
355-
RelayMode::Static => write!(f, "static"),
356369
RelayMode::Managed => write!(f, "managed"),
357370
}
358371
}
@@ -402,10 +415,7 @@ pub struct ParseRelayModeError;
402415

403416
impl fmt::Display for ParseRelayModeError {
404417
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
405-
write!(
406-
f,
407-
"Relay mode must be one of: managed, static, proxy, capture"
408-
)
418+
write!(f, "Relay mode must be one of: managed or proxy")
409419
}
410420
}
411421

@@ -417,7 +427,6 @@ impl FromStr for RelayMode {
417427
fn from_str(s: &str) -> Result<Self, Self::Err> {
418428
match s {
419429
"proxy" => Ok(RelayMode::Proxy),
420-
"static" => Ok(RelayMode::Static),
421430
"managed" => Ok(RelayMode::Managed),
422431
_ => Err(ParseRelayModeError),
423432
}

relay-server/src/processing/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ impl Context<'_> {
9292
use relay_config::RelayMode::*;
9393

9494
match self.config.relay_mode() {
95-
Proxy | Static => false,
95+
Proxy => false,
9696
Managed => !self.project_info.has_feature(feature),
9797
}
9898
}

relay-server/src/services/processor.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -827,7 +827,7 @@ fn event_type(event: &Annotated<Event>) -> Option<EventType> {
827827
/// If the project config did not come from the upstream, we keep the items.
828828
fn should_filter(config: &Config, project_info: &ProjectInfo, feature: Feature) -> bool {
829829
match config.relay_mode() {
830-
RelayMode::Proxy | RelayMode::Static => false,
830+
RelayMode::Proxy => false,
831831
RelayMode::Managed => !project_info.has_feature(feature),
832832
}
833833
}

relay-server/src/services/projects/project/mod.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,7 @@ pub struct ParsedProjectState {
105105
pub disabled: bool,
106106
/// Project info.
107107
///
108-
/// This contains no information when `disabled` is `true`, except for
109-
/// public keys in static project configs (see [`crate::services::projects::source::local`]).
108+
/// This contains no information when `disabled` is `true`.
110109
#[serde(flatten)]
111110
pub info: ProjectInfo,
112111
}
@@ -119,8 +118,7 @@ pub struct LimitedParsedProjectState {
119118
pub disabled: bool,
120119
/// Limited project info for external Relays.
121120
///
122-
/// This contains no information when `disabled` is `true`, except for
123-
/// public keys in static project configs (see [`crate::services::projects::source::local`]).
121+
/// This contains no information when `disabled` is `true`.
124122
#[serde(with = "LimitedProjectInfo")]
125123
#[serde(flatten)]
126124
pub info: ProjectInfo,

0 commit comments

Comments
 (0)