Skip to content

Commit eb828c7

Browse files
committed
Merge branch 'master' into ref/envelope-security-item
* master: ref(quotas): Remove support for legacy quotas (#616) feat(server): Implement an HTTP outcomes producer (#592)
2 parents 36b9957 + ee732df commit eb828c7

File tree

17 files changed

+457
-444
lines changed

17 files changed

+457
-444
lines changed

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,14 @@ We have switched to [CalVer](https://calver.org/)! Relay's version is always in
1919

2020
**Internal**:
2121

22+
- Add support for Outcomes generation in non processing relays.([#592](https://github.com/getsentry/relay/pull/592))
2223
- Ignore non-Rust folders for faster rebuilding and testing. ([#578](https://github.com/getsentry/relay/pull/578))
2324
- Invalid session payloads are now logged for SDK debugging. ([#584](https://github.com/getsentry/relay/pull/584), [#591](https://github.com/getsentry/relay/pull/591))
2425
- Remove unused `rev` from project state. ([#586](https://github.com/getsentry/relay/pull/586))
2526
- Add an outcome endpoint for trusted Relays. ([#589](https://github.com/getsentry/relay/pull/589))
2627
- Emit outcomes for event payloads submitted in attachment files. ([#609](https://github.com/getsentry/relay/pull/609))
2728
- Split envelopes that contain sessions and other items and ingest them independently. ([#610](https://github.com/getsentry/relay/pull/610))
29+
- Removed support for legacy per-key quotas. ([#616](https://github.com/getsentry/relay/pull/615))
2830

2931
## 0.5.9
3032

relay-config/src/config.rs

+39-6
Original file line numberDiff line numberDiff line change
@@ -351,9 +351,6 @@ pub struct Relay {
351351
pub tls_identity_path: Option<PathBuf>,
352352
/// Password for the PKCS12 archive.
353353
pub tls_identity_password: Option<String>,
354-
/// Controls whether outcomes will be emitted when processing is disabled.
355-
/// Processing relays always emit outcomes (for backwards compatibility).
356-
pub emit_outcomes: bool,
357354
}
358355

359356
impl Default for Relay {
@@ -366,7 +363,6 @@ impl Default for Relay {
366363
tls_port: None,
367364
tls_identity_path: None,
368365
tls_identity_password: None,
369-
emit_outcomes: false,
370366
}
371367
}
372368
}
@@ -710,6 +706,31 @@ impl Default for Processing {
710706
}
711707
}
712708

709+
/// Outcome generation specific configuration values.
710+
#[derive(Serialize, Deserialize, Debug)]
711+
#[serde(default)]
712+
pub struct Outcomes {
713+
/// Controls whether outcomes will be emitted when processing is disabled.
714+
/// Processing relays always emit outcomes (for backwards compatibility).
715+
pub emit_outcomes: bool,
716+
/// The maximum number of outcomes that are batched before being sent
717+
/// via http to the upstream (only applies to non processing relays)
718+
pub batch_size: usize,
719+
/// The maximum time interval (in milliseconds) that an outcome may be batched
720+
/// via http to the upstream (only applies to non processing relays)
721+
pub batch_interval: u64,
722+
}
723+
724+
impl Default for Outcomes {
725+
fn default() -> Self {
726+
Outcomes {
727+
emit_outcomes: false,
728+
batch_size: 1000,
729+
batch_interval: 500,
730+
}
731+
}
732+
}
733+
713734
/// Minimal version of a config for dumping out.
714735
#[derive(Serialize, Deserialize, Debug, Default)]
715736
pub struct MinimalConfig {
@@ -757,6 +778,8 @@ struct ConfigValues {
757778
sentry: Sentry,
758779
#[serde(default)]
759780
processing: Processing,
781+
#[serde(default)]
782+
outcomes: Outcomes,
760783
}
761784

762785
impl ConfigObject for ConfigValues {
@@ -838,7 +861,7 @@ impl Config {
838861
"true" | "1" => processing.enabled = true,
839862
"false" | "0" | "" => processing.enabled = false,
840863
_ => {
841-
return Err(ConfigError::new(ConfigErrorKind::InvalidValue).field("processing"))
864+
return Err(ConfigError::new(ConfigErrorKind::InvalidValue).field("processing"));
842865
}
843866
}
844867
}
@@ -1044,7 +1067,17 @@ impl Config {
10441067

10451068
/// Returns the emit_outcomes flag
10461069
pub fn emit_outcomes(&self) -> bool {
1047-
self.values.relay.emit_outcomes
1070+
self.values.outcomes.emit_outcomes
1071+
}
1072+
1073+
/// Returns the maximum number of outcomes that are batched before being sent
1074+
pub fn outcome_batch_size(&self) -> usize {
1075+
self.values.outcomes.batch_size
1076+
}
1077+
1078+
/// Returns the maximum interval that an outcome may be batched
1079+
pub fn outcome_batch_interval(&self) -> Duration {
1080+
Duration::from_millis(self.values.outcomes.batch_interval)
10481081
}
10491082

10501083
/// Returns the log level.

relay-quotas/Cargo.toml

-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ redis = [
1717
"relay-redis/impl",
1818
"sentry",
1919
]
20-
legacy = []
2120

2221
[dependencies]
2322
failure = { version = "0.1.5", optional = true }

relay-quotas/src/legacy.rs

-240
This file was deleted.

relay-quotas/src/lib.rs

-3
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@ mod rate_limit;
1212
pub use self::quota::*;
1313
pub use self::rate_limit::*;
1414

15-
#[cfg(feature = "legacy")]
16-
pub mod legacy;
17-
1815
#[cfg(feature = "redis")]
1916
mod redis;
2017
#[cfg(feature = "redis")]

relay-server/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ relay-common = { path = "../relay-common" }
4545
relay-config = { path = "../relay-config" }
4646
relay-filter = { path = "../relay-filter" }
4747
relay-general = { path = "../relay-general" }
48-
relay-quotas = { path = "../relay-quotas", features = ["legacy"] }
48+
relay-quotas = { path = "../relay-quotas" }
4949
relay-redis = { path = "../relay-redis" }
5050
rmp-serde = "0.14.3"
5151
sentry = "0.18.0"

relay-server/src/actors/events.rs

+1-9
Original file line numberDiff line numberDiff line change
@@ -497,15 +497,7 @@ impl EventProcessor {
497497
None => return Ok(()),
498498
};
499499

500-
let public_key = envelope.meta().public_key();
501-
let quotas = if !state.config.quotas.is_empty() {
502-
state.config.quotas.as_slice()
503-
} else if let Some(ref key_config) = state.get_public_key_config(public_key) {
504-
key_config.legacy_quotas.as_slice()
505-
} else {
506-
&[]
507-
};
508-
500+
let quotas = state.config.quotas.as_slice();
509501
if quotas.is_empty() {
510502
return Ok(());
511503
}

0 commit comments

Comments
 (0)