Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
**Breaking Changes**:

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

**Features**:

Expand Down
35 changes: 22 additions & 13 deletions relay-config/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ impl RelayInfo {
}

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

/// This relay is configured statically in the file system.
///
/// Events are only accepted for projects configured statically in the file system. All other
/// events are rejected. If configured, PII stripping is also performed on those events.
Static,

/// Project configurations are managed by the upstream.
///
/// Project configurations are always fetched from the upstream, unless they are statically
Expand All @@ -348,11 +342,30 @@ pub enum RelayMode {
Managed,
}

impl<'de> Deserialize<'de> for RelayMode {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
D: Deserializer<'de>,
{
let s = String::deserialize(deserializer)?;
match s.as_str() {
"proxy" => Ok(RelayMode::Proxy),
"managed" => Ok(RelayMode::Managed),
"static" => Err(serde::de::Error::custom(
"Relay mode 'static' has been removed. Please use 'managed' or 'proxy' instead.",
)),
other => Err(serde::de::Error::unknown_variant(
other,
&["proxy", "managed"],
)),
}
}
}

impl fmt::Display for RelayMode {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match self {
RelayMode::Proxy => write!(f, "proxy"),
RelayMode::Static => write!(f, "static"),
RelayMode::Managed => write!(f, "managed"),
}
}
Expand Down Expand Up @@ -402,10 +415,7 @@ pub struct ParseRelayModeError;

impl fmt::Display for ParseRelayModeError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(
f,
"Relay mode must be one of: managed, static, proxy, capture"
)
write!(f, "Relay mode must be one of: managed or proxy")
}
}

Expand All @@ -417,7 +427,6 @@ impl FromStr for RelayMode {
fn from_str(s: &str) -> Result<Self, Self::Err> {
match s {
"proxy" => Ok(RelayMode::Proxy),
"static" => Ok(RelayMode::Static),
"managed" => Ok(RelayMode::Managed),
_ => Err(ParseRelayModeError),
}
Expand Down
2 changes: 1 addition & 1 deletion relay-server/src/processing/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ impl Context<'_> {
use relay_config::RelayMode::*;

match self.config.relay_mode() {
Proxy | Static => false,
Proxy => false,
Managed => !self.project_info.has_feature(feature),
}
}
Expand Down
2 changes: 1 addition & 1 deletion relay-server/src/services/processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -827,7 +827,7 @@ fn event_type(event: &Annotated<Event>) -> Option<EventType> {
/// If the project config did not come from the upstream, we keep the items.
fn should_filter(config: &Config, project_info: &ProjectInfo, feature: Feature) -> bool {
match config.relay_mode() {
RelayMode::Proxy | RelayMode::Static => false,
RelayMode::Proxy => false,
RelayMode::Managed => !project_info.has_feature(feature),
}
}
Expand Down
6 changes: 2 additions & 4 deletions relay-server/src/services/projects/project/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,7 @@ pub struct ParsedProjectState {
pub disabled: bool,
/// Project info.
///
/// This contains no information when `disabled` is `true`, except for
/// public keys in static project configs (see [`crate::services::projects::source::local`]).
/// This contains no information when `disabled` is `true`.
#[serde(flatten)]
pub info: ProjectInfo,
}
Expand All @@ -119,8 +118,7 @@ pub struct LimitedParsedProjectState {
pub disabled: bool,
/// Limited project info for external Relays.
///
/// This contains no information when `disabled` is `true`, except for
/// public keys in static project configs (see [`crate::services::projects::source::local`]).
/// This contains no information when `disabled` is `true`.
#[serde(with = "LimitedProjectInfo")]
#[serde(flatten)]
pub info: ProjectInfo,
Expand Down
Loading
Loading