Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ref(normalization): Remove TransactionsProcessor #2714

Merged
merged 3 commits into from
Nov 16, 2023

Conversation

iker-barriocanal
Copy link
Contributor

@iker-barriocanal iker-barriocanal commented Nov 10, 2023

This PR removes the transaction processor and moves its normalization to NormalizeProcessor, bringing us a step closer to having a single processor. There are no new normalization steps in this PR.

#skip-changelog

@iker-barriocanal iker-barriocanal self-assigned this Nov 10, 2023
@iker-barriocanal iker-barriocanal requested a review from a team November 10, 2023 10:41
Comment on lines +109 to +111
if let Some(trace_context) = event.context_mut::<TraceContext>() {
trace_context.op.get_or_insert_with(|| "default".to_owned());
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was part of validate_transaction, but moving it here allows the validation function to accept a &event instead of &mut event.

// TODO: Parts of this processor should probably be a filter so we
// can revert some changes to ProcessingAction)

validate_transaction(event, self.config.transaction_range.as_ref())?;
Copy link
Contributor Author

@iker-barriocanal iker-barriocanal Nov 10, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The validation happened after normalizing the transaction name, a few lines below. Since validation does not depend on the transaction name, moving it to the top here allows Relay to reject invalid transactions a bit earlier and save some computing. Note the outcome does not change. Happy to move this to another PR if this feels out of scope.

@@ -1362,6 +1326,11 @@ mod tests {
},
]"#);

assert_eq!(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These assertions on the transaction source were lost in a previous PR, adding them back in this one.

let processor_config = NormalizeProcessorConfig::default();
let mut processor = NormalizeProcessor::new(processor_config.clone());
process_value(&mut processed, &mut processor, ProcessingState::root()).unwrap();
remove_event_received(&mut processed);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

event.received is always updated with the latest timestamp, so removing it from the events makes us compare them easily. This is not new functionality and is already the case, see:

fn test_light_normalization_is_idempotent() {

We can probably get rid of some tests when we unify more functionality.

@@ -510,7 +478,7 @@ mod tests {
fn test_replace_missing_timestamp() {
let span = Span {
start_timestamp: Annotated::new(
Utc.with_ymd_and_hms(1968, 1, 1, 0, 0, 1).unwrap().into(),
Utc.with_ymd_and_hms(1970, 1, 1, 0, 0, 1).unwrap().into(),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the normalize processor now runs more logic, it'll drop spans happening before 1970/1/1. This fixes the test while keeping it valid.

relay-event-normalization/src/normalize/processor.rs Outdated Show resolved Hide resolved
relay-event-normalization/src/normalize/processor.rs Outdated Show resolved Hide resolved
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this file actually be remove/renamed now? It doesn't contain processor anymore and it's more like utils for validation and looks like only 1 function for normalization.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good suggestion! I'll get to this in a follow-up PR, this one is already big enough.

Copy link
Contributor

@TBS1996 TBS1996 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would be nice if we could avoid pub(crate) i think, but other than that looks good to me.

I assume you didn't change any of the functions you moved where you didn't specify it while i was reviewing

relay-event-normalization/src/normalize/processor.rs Outdated Show resolved Hide resolved
@iker-barriocanal iker-barriocanal merged commit 0cc7cb0 into master Nov 16, 2023
20 checks passed
@iker-barriocanal iker-barriocanal deleted the iker/ref/rm-tx-proc branch November 16, 2023 09:44
jan-auer added a commit that referenced this pull request Nov 16, 2023
* master:
  feat(protocol): Add access to `device.model` on contexts (#2728)
  Revert "feat(protocol): Support comparisons in rule conditions on strings" (#2727)
  ref(normalization): Remove TransactionsProcessor (#2714)
  feat(protocol): Support comparisons in rule conditions on strings (#2721)
  test(normalization): Reduce span default op test scope (#2726)
  release: 23.11.0
  fix(normalization): Restore performance score normalization (#2725)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants