Skip to content

Commit

Permalink
Fixed outcome config naming
Browse files Browse the repository at this point in the history
  • Loading branch information
RaduW committed Jun 8, 2020
1 parent c5885c4 commit bc6cc3b
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 18 deletions.
12 changes: 6 additions & 6 deletions relay-config/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -715,18 +715,18 @@ pub struct Outcomes {
pub emit_outcomes: bool,
/// The maximum number of outcomes that are batched before being sent
/// via http to the upstream (only applies to non processing relays)
pub max_outcome_batch_size: usize,
pub max_batch_size: usize,
/// The maximum time interval (in milliseconds) that an outcome may be batched
/// via http to the upstream (only applies to non processing relays)
pub max_outcome_interval_millsec: u64,
pub max_interval: u64,
}

impl Default for Outcomes {
fn default() -> Self {
Outcomes {
emit_outcomes: false,
max_outcome_batch_size: 1000,
max_outcome_interval_millsec: 500,
max_batch_size: 1000,
max_interval: 500,
}
}
}
Expand Down Expand Up @@ -1072,12 +1072,12 @@ impl Config {

/// Returns the maximum number of outcomes that are batched before being sent
pub fn max_outcome_batch_size(&self) -> usize {
self.values.outcomes.max_outcome_batch_size
self.values.outcomes.max_batch_size
}

/// Returns the maximum interval that an outcome may be batched
pub fn max_outcome_interval(&self) -> Duration {
Duration::from_millis(self.values.outcomes.max_outcome_interval_millsec)
Duration::from_millis(self.values.outcomes.max_interval)
}

/// Returns the log level.
Expand Down
5 changes: 2 additions & 3 deletions relay-server/src/actors/outcome.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
//! must be emitted in the entire ingestion pipeline. Since Relay is only one part in this pipeline,
//! outcomes may not be emitted if the event is accepted.

use std::borrow::Cow;
use std::mem;
use std::net::IpAddr;
use std::sync::Arc;
use std::time::Instant;
Expand Down Expand Up @@ -34,9 +36,6 @@ pub type OutcomeProducer = processing::ProcessingOutcomeProducer;
#[cfg(not(feature = "processing"))]
pub type OutcomeProducer = HttpOutcomeProducer;

use std::borrow::Cow;
use std::mem;

/// Defines the structure of the HTTP outcomes requests
#[derive(Deserialize, Serialize, Debug, Default)]
pub struct SendOutcomes {
Expand Down
18 changes: 9 additions & 9 deletions tests/integration/test_outcome.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ def test_outcomes_non_processing(relay, relay_with_processing, mini_sentry):
config = {
"outcomes": {
"emit_outcomes": True,
"max_outcome_batch_size": 1,
"max_outcome_interval_millsec": 1,
"max_batch_size": 1,
"max_interval": 1,
}
}

Expand Down Expand Up @@ -130,8 +130,8 @@ def test_outcomes_not_sent_when_disabled(relay, mini_sentry):
config = {
"outcomes": {
"emit_outcomes": False,
"max_outcome_batch_size": 1,
"max_outcome_interval_millsec": 1,
"max_batch_size": 1,
"max_interval": 1,
}
}

Expand All @@ -157,8 +157,8 @@ def test_outcomes_non_processing_max_batch_time(relay, mini_sentry):
config = {
"outcomes": {
"emit_outcomes": True,
"max_outcome_batch_size": 1000, # a huge batch size
"max_outcome_interval_millsec": 1, # very short batch time
"max_batch_size": 1000, # a huge batch size
"max_interval": 1, # very short batch time
}
}
relay = relay(mini_sentry, config)
Expand All @@ -171,7 +171,7 @@ def test_outcomes_non_processing_max_batch_time(relay, mini_sentry):
for i in range(events_to_send):
event_id = _send_event(relay)
event_ids.add(event_id)
time.sleep(0.002) # sleep more than the batch time
time.sleep(0.005) # sleep more than the batch time

# we should get one batch per event sent
batches = []
Expand All @@ -196,8 +196,8 @@ def test_outcomes_non_processing_batching(relay, mini_sentry):
config = {
"outcomes": {
"emit_outcomes": True,
"max_outcome_batch_size": batch_size,
"max_outcome_interval_millsec": HOUR_MILLISEC, # batch every hour
"max_batch_size": batch_size,
"max_interval": HOUR_MILLISEC, # batch every hour
}
}

Expand Down

0 comments on commit bc6cc3b

Please sign in to comment.