Skip to content

Commit

Permalink
feat(normalization): Use exposed device-class-synthesis feature flag …
Browse files Browse the repository at this point in the history
…to gate device.class synthesis in light normalization (#1974)

Uses the exposed `organizations:device-class-synthesis` sentry feature
flag to gate synthesis of the `device.class` tag. This is a temporary
flag for managing rollout to EA users and eventually to be removed for
GA release.
  • Loading branch information
edwardgou-sentry committed Mar 31, 2023
1 parent 897ca0e commit 01299a5
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ Metrics:

- Upgrade the web framework and related dependencies. ([#1938](https://github.com/getsentry/relay/pull/1938))
- Apply transaction clustering rules before UUID scrubbing rules. ([#1964](https://github.com/getsentry/relay/pull/1964))
- Use exposed device-class-synthesis feature flag to gate device.class synthesis in light normalization. ([#1974](https://github.com/getsentry/relay/pull/1974))
- Use types from `sentry-kafka-schemas` crate to validate metrics messages into kafka. ([#1981](https://github.com/getsentry/relay/pull/1981))

## 23.3.1
Expand Down
1 change: 1 addition & 0 deletions relay-cabi/src/processing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ pub unsafe extern "C" fn relay_store_normalizer_normalize_event(
normalize_user_agent: config.normalize_user_agent,
transaction_name_config: Default::default(), // only supported in relay
is_renormalize: config.is_renormalize.unwrap_or(false),
device_class_synthesis_config: false, // only supported in relay
};
light_normalize_event(&mut event, light_normalization_config)?;
process_value(&mut event, &mut *processor, ProcessingState::root())?;
Expand Down
5 changes: 5 additions & 0 deletions relay-dynamic-config/src/feature.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ pub enum Feature {
/// Transaction names modified by clusterer rules are always marked as such.
#[serde(rename = "organizations:transaction-name-mark-scrubbed-as-sanitized")]
TransactionNameMarkScrubbedAsSanitized,
/// Enables device.class synthesis
///
/// Enables device.class tag synthesis on mobile events.
#[serde(rename = "organizations:device-class-synthesis")]
DeviceClassSynthesis,
/// Unused.
///
/// This used to control the initial experimental metrics extraction for sessions and has been
Expand Down
7 changes: 6 additions & 1 deletion relay-general/src/store/normalize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -687,6 +687,7 @@ pub struct LightNormalizationConfig<'a> {
pub normalize_user_agent: Option<bool>,
pub transaction_name_config: TransactionNameConfig<'a>,
pub is_renormalize: bool,
pub device_class_synthesis_config: bool,
}

pub fn light_normalize_event(
Expand Down Expand Up @@ -749,7 +750,11 @@ pub fn light_normalize_event(
config.max_secs_in_future,
)?; // Timestamps are core in the metrics extraction
normalize_event_tags(event)?; // Tags are added to every metric
normalize_device_class(event);

// TODO: Consider moving to store normalization
if config.device_class_synthesis_config {
normalize_device_class(event);
}
light_normalize_stacktraces(event)?;
normalize_exceptions(event)?; // Browser extension filters look at the stacktrace
normalize_user_agent(event, config.normalize_user_agent); // Legacy browsers filter
Expand Down
4 changes: 3 additions & 1 deletion relay-server/src/actors/processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2222,7 +2222,9 @@ impl EnvelopeProcessorService {
.has_feature(Feature::TransactionNameMarkScrubbedAsSanitized),
rules: &state.project_state.config.tx_name_rules,
},

device_class_synthesis_config: state
.project_state
.has_feature(Feature::DeviceClassSynthesis),
is_renormalize: false,
};

Expand Down

0 comments on commit 01299a5

Please sign in to comment.