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

feat(spans): Normalize and copy measurements to segments #2953

Merged
merged 20 commits into from
Jan 22, 2024

Conversation

phacops
Copy link
Contributor

@phacops phacops commented Jan 16, 2024

This will:

  • Add measurements normalization to the span normalization function
  • Copy measurements to the segment

@phacops phacops requested a review from a team as a code owner January 16, 2024 17:11
Copy link
Member

@jjbayer jjbayer left a comment

Choose a reason for hiding this comment

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

As discussed, instead of running normalization on spans extracted from events twice, let's make SpanKafkaMessage as strict as the kafka schema and "normalize" the message before producing, like we do here:

sentry_tags.retain(|key, value| match value.value() {
Some(s) => {
match key.as_str() {
"group" => {
// Only allow up to 16-char hex strings in group.
s.len() <= 16 && s.chars().all(|c| c.is_ascii_hexdigit())
}
"status_code" => s.parse::<u16>().is_ok(),
_ => true,
}
}

We should probably also make the numeric values in SpanKafkaMessage the new FiniteF64, because serde_json will serialize infinity / NaN as null as well.

@phacops phacops requested a review from jjbayer January 18, 2024 16:16
@jjbayer jjbayer self-assigned this Jan 19, 2024
Copy link
Member

@jjbayer jjbayer left a comment

Choose a reason for hiding this comment

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

Please see comments before merging. No blockers, but we still cannot be 100% sure that this won't generate new validation errors on the consumer side. To prevent that, I think we need to make SpanKafkaMessage more strict (this would sacrifice some performance) and / or make the consumer more lenient. See also Sentry's development philosophy:

“be conservative in what you send, be liberal in what you accept”.

The second bullet point in the PR description can be removed I believe.

relay-event-normalization/src/event.rs Outdated Show resolved Hide resolved
relay-event-normalization/src/event.rs Show resolved Hide resolved
relay-server/src/services/processor/span/processing.rs Outdated Show resolved Hide resolved
relay-server/src/services/processor/span/processing.rs Outdated Show resolved Hide resolved
relay-server/src/services/processor/span/processing.rs Outdated Show resolved Hide resolved
relay-server/src/services/processor/span/processing.rs Outdated Show resolved Hide resolved
relay-server/src/services/processor/span/processing.rs Outdated Show resolved Hide resolved
relay-server/src/services/processor/span/processing.rs Outdated Show resolved Hide resolved
CHANGELOG.md Outdated Show resolved Hide resolved
@phacops phacops force-pushed the pierre/spans-copy-measurements-to-segment-3 branch from 7f356d2 to 32d66ee Compare January 19, 2024 16:23
Copy link
Member

@jjbayer jjbayer left a comment

Choose a reason for hiding this comment

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

See comments about RawValue.

relay-server/src/services/store.rs Outdated Show resolved Hide resolved
relay-server/src/services/store.rs Outdated Show resolved Hide resolved
tests/integration/test_store.py Outdated Show resolved Hide resolved
tests/integration/test_store.py Show resolved Hide resolved
relay-server/src/services/store.rs Outdated Show resolved Hide resolved
relay-server/src/services/processor/span/processing.rs Outdated Show resolved Hide resolved
@phacops phacops enabled auto-merge (squash) January 22, 2024 15:45
@phacops phacops merged commit b493baf into master Jan 22, 2024
20 checks passed
@phacops phacops deleted the pierre/spans-copy-measurements-to-segment-3 branch January 22, 2024 15:53
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.

2 participants