Skip to content

Commit

Permalink
ref(normalization): Replace LightNormalization with NormalizeProcessor (
Browse files Browse the repository at this point in the history
  • Loading branch information
iker-barriocanal authored Nov 17, 2023
1 parent 943a276 commit 2f0602e
Show file tree
Hide file tree
Showing 10 changed files with 451 additions and 333 deletions.
10 changes: 7 additions & 3 deletions relay-cabi/src/processing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use once_cell::sync::OnceCell;
use relay_common::glob::{glob_match_bytes, GlobOptions};
use relay_dynamic_config::{normalize_json, validate_json, GlobalConfig, ProjectConfig};
use relay_event_normalization::{
light_normalize_event, GeoIpLookup, LightNormalizationConfig, RawUserAgentInfo, StoreConfig,
GeoIpLookup, NormalizeProcessor, NormalizeProcessorConfig, RawUserAgentInfo, StoreConfig,
StoreProcessor,
};
use relay_event_schema::processor::{process_value, split_chunks, ProcessingState};
Expand Down Expand Up @@ -112,7 +112,7 @@ pub unsafe extern "C" fn relay_store_normalizer_normalize_event(
let processor = normalizer as *mut StoreProcessor;
let mut event = Annotated::<Event>::from_json((*event).as_str())?;
let config = (*processor).config();
let light_normalization_config = LightNormalizationConfig {
let normalization_config = NormalizeProcessorConfig {
client_ip: config.client_ip.as_ref(),
user_agent: RawUserAgentInfo {
user_agent: config.user_agent.as_deref(),
Expand All @@ -137,7 +137,11 @@ pub unsafe extern "C" fn relay_store_normalizer_normalize_event(
enable_trimming: config.enable_trimming.unwrap_or_default(),
measurements: None,
};
light_normalize_event(&mut event, light_normalization_config)?;
process_value(
&mut event,
&mut NormalizeProcessor::new(normalization_config),
ProcessingState::root(),
)?;
process_value(&mut event, &mut *processor, ProcessingState::root())?;
RelayStr::from_string(event.to_json()?)
}
Expand Down
2 changes: 1 addition & 1 deletion relay-event-normalization/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ pub struct StoreConfig {

/// The processor that normalizes events for processing and storage.
///
/// This processor is a superset of [`light_normalize_event`], that runs additional and heavier
/// This processor is a superset of [`NormalizeProcessor`], that runs additional and heavier
/// normalization steps. These normalizations should ideally be performed on events that are likely
/// to be ingested, after other functionality such as inbound filters have run.
///
Expand Down
Loading

0 comments on commit 2f0602e

Please sign in to comment.