Skip to content
New issue

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

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

Already on GitHub? # to your account

feat(normalization): Remove stale spans from transactions #2627

Merged
merged 8 commits into from
Oct 20, 2023

Conversation

iker-barriocanal
Copy link
Contributor

There are some cases where spans with stale timestamps reach Relay. Relay doesn't perform full normalization on these and forwards them, causing issues in later parts of the pipeline. This PR extends the TimestampProcessor to remove stale spans from events.

There are some cases where spans with stale timestamps reach Relay.
Relay doesn't perform full normalization on these and forwards them,
causing issues in later parts of the pipeline. This PR extends the
`TimestampProcessor` to remove stale spans from events.
@iker-barriocanal iker-barriocanal self-assigned this Oct 18, 2023
@iker-barriocanal iker-barriocanal requested a review from a team October 18, 2023 11:47
Ok(())
}

fn process_span(
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Docs for the processor are up-to-date, I accidentally updated them in the previous PR.

Comment on lines 53 to 70
if let Some(start_timestamp) = span.start_timestamp.value() {
if start_timestamp.into_inner().timestamp_millis() < 0 {
meta.add_error(Error::invalid(format!(
"timestamp is too stale: {}",
start_timestamp
)));
return Err(ProcessingAction::DeleteValueHard);
}
}
if let Some(end_timestamp) = span.timestamp.value() {
if end_timestamp.into_inner().timestamp_millis() < 0 {
meta.add_error(Error::invalid(format!(
"timestamp is too stale: {}",
end_timestamp
)));
return Err(ProcessingAction::DeleteValueHard);
}
}
Copy link
Member

Choose a reason for hiding this comment

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

What if we put this logic in process_timestamp instead of process_span? That should automatically cover all timestamps, plus it would attach the meta error to the correct field.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That will deal with only the timestamp itself, but we want to take action on the container of the timestamp. For spans, this means dropping the span; for transactions, this means dropping the entire event. We can't have this level of control in process_timestamp unfortunately.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I explored introducing a new type of error to remove the parent container. This approach can work for calls on top-level containers like events, but it requires major refactors and decreases development experience a lot for child components like distributions. For that reason, I'm going to stick to the current approach.

relay-event-normalization/src/timestamp.rs Outdated Show resolved Hide resolved
relay-event-normalization/src/timestamp.rs Outdated Show resolved Hide resolved
@iker-barriocanal iker-barriocanal merged commit c535093 into master Oct 20, 2023
20 checks passed
@iker-barriocanal iker-barriocanal deleted the iker/feat/drop-stale-spans branch October 20, 2023 08:15
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants