Skip to content

Commit

Permalink
ref(feedback): clean up feedback topic rollout option (#3916)
Browse files Browse the repository at this point in the history
Ref getsentry/sentry#66100

The topic and consumer has been deployed to all regions, and this option
is 1.0 everywhere:
https://github.com/search?q=repo%3Agetsentry%2Fsentry-options-automator%20topic.rollout&type=code.

After getsentry/self-hosted#3193 was merged,
this is true for self-hosted as well. We don't have to worry about a
migration there because this is the first PR enabling user feedback in
SH.

Follow-up: remove from
- getsentry
- self-hosted
- finally, options-automator
  • Loading branch information
aliu39 committed Aug 12, 2024
1 parent 2aa4253 commit f595bee
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 53 deletions.
11 changes: 0 additions & 11 deletions relay-dynamic-config/src/global.rs
Original file line number Diff line number Diff line change
Expand Up @@ -186,17 +186,6 @@ pub struct Options {
)]
pub metric_stats_rollout_rate: f32,

/// Rollout rate for producing to the ingest-feedback-events topic.
///
/// Rate needs to be between `0.0` and `1.0`.
/// If set to `1.0` all organizations will ingest to the feedback topic.
#[serde(
rename = "feedback.ingest-topic.rollout-rate",
deserialize_with = "default_on_error",
skip_serializing_if = "is_default"
)]
pub feedback_ingest_topic_rollout_rate: f32,

/// Overall sampling of span extraction.
///
/// This number represents the fraction of transactions for which
Expand Down
16 changes: 2 additions & 14 deletions relay-server/src/services/store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ use crate::services::global_config::GlobalConfigHandle;
use crate::services::outcome::{DiscardReason, Outcome, TrackOutcome};
use crate::services::processor::Processed;
use crate::statsd::{RelayCounters, RelayTimers};
use crate::utils::{is_rolled_out, FormDataIter, ThreadPool, TypedEnvelope, WorkerGroup};
use crate::utils::{FormDataIter, ThreadPool, TypedEnvelope, WorkerGroup};

/// Fallback name used for attachment items without a `filename` header.
const UNNAMED_ATTACHMENT: &str = "Unnamed Attachment";
Expand Down Expand Up @@ -257,7 +257,6 @@ impl StoreService {
self.produce_user_report_v2(
event_id.ok_or(StoreError::NoEventId)?,
scoping.project_id,
scoping.organization_id,
start_time,
item,
remote_addr,
Expand Down Expand Up @@ -657,21 +656,10 @@ impl StoreService {
&self,
event_id: EventId,
project_id: ProjectId,
organization_id: u64,
start_time: Instant,
item: &Item,
remote_addr: Option<String>,
) -> Result<(), StoreError> {
// check rollout rate option (effectively a FF) to determine whether to produce to new infra
let global_config = self.global_config.current();
let feedback_ingest_topic_rollout_rate =
global_config.options.feedback_ingest_topic_rollout_rate;
let topic = if is_rolled_out(organization_id, feedback_ingest_topic_rollout_rate) {
KafkaTopic::Feedback
} else {
KafkaTopic::Events
};

let message = KafkaMessage::Event(EventKafkaMessage {
project_id,
event_id,
Expand All @@ -680,7 +668,7 @@ impl StoreService {
remote_addr,
attachments: vec![],
});
self.produce(topic, message)
self.produce(KafkaTopic::Feedback, message)
}

fn send_metric_message(
Expand Down
33 changes: 5 additions & 28 deletions tests/integration/test_feedback.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import pytest
import json
from sentry_sdk.envelope import Envelope, Item, PayloadRef

Expand Down Expand Up @@ -88,26 +87,18 @@ def assert_expected_feedback(parsed_feedback, sent_feedback):
}


@pytest.mark.parametrize("use_feedback_topic", (False, True))
def test_feedback_event_with_processing(
mini_sentry,
relay_with_processing,
events_consumer,
feedback_consumer,
use_feedback_topic,
):
mini_sentry.add_basic_project_config(
42, extra={"config": {"features": ["organizations:user-feedback-ingest"]}}
)

if use_feedback_topic:
mini_sentry.set_global_config_option("feedback.ingest-topic.rollout-rate", 1.0)
consumer = feedback_consumer(timeout=20)
other_consumer = events_consumer(timeout=20)
else:
mini_sentry.set_global_config_option("feedback.ingest-topic.rollout-rate", 0.0)
consumer = events_consumer(timeout=20)
other_consumer = feedback_consumer(timeout=20)
consumer = feedback_consumer(timeout=20)
other_consumer = events_consumer(timeout=20)

feedback = generate_feedback_sdk_event()
relay = relay_with_processing()
Expand All @@ -124,18 +115,12 @@ def test_feedback_event_with_processing(
other_consumer.assert_empty()


@pytest.mark.parametrize("use_feedback_topic", (False, True))
def test_feedback_events_without_processing(
mini_sentry, relay_chain, use_feedback_topic
):
def test_feedback_events_without_processing(mini_sentry, relay_chain):
project_id = 42
mini_sentry.add_basic_project_config(
project_id,
extra={"config": {"features": ["organizations:user-feedback-ingest"]}},
)
mini_sentry.set_global_config_option(
"feedback.ingest-topic.rollout-rate", 1.0 if use_feedback_topic else 0.0
)

replay_item = generate_feedback_sdk_event()
relay = relay_chain(min_relay_version="latest")
Expand All @@ -148,27 +133,19 @@ def test_feedback_events_without_processing(
assert userfeedback.type == "feedback"


@pytest.mark.parametrize("use_feedback_topic", (False, True))
def test_feedback_with_attachment_in_same_envelope(
mini_sentry,
relay_with_processing,
feedback_consumer,
events_consumer,
attachments_consumer,
use_feedback_topic,
):
mini_sentry.add_basic_project_config(
42, extra={"config": {"features": ["organizations:user-feedback-ingest"]}}
)

if use_feedback_topic:
mini_sentry.set_global_config_option("feedback.ingest-topic.rollout-rate", 1.0)
other_consumer = events_consumer(timeout=20)
feedback_consumer = feedback_consumer(timeout=20)
else:
mini_sentry.set_global_config_option("feedback.ingest-topic.rollout-rate", 0.0)
other_consumer = feedback_consumer(timeout=20)
feedback_consumer = events_consumer(timeout=20)
other_consumer = events_consumer(timeout=20)
feedback_consumer = feedback_consumer(timeout=20)
attachments_consumer = attachments_consumer(timeout=20)

feedback = generate_feedback_sdk_event()
Expand Down

0 comments on commit f595bee

Please sign in to comment.