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

fix(profiling): Warn on invalid JSON errors #1685

Merged
merged 2 commits into from
Dec 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
- Track metrics for OpenTelemetry events. ([#1618](https://github.com/getsentry/relay/pull/1618))
- Normalize transaction name for URLs transaction source, by replacing UUIDs, SHAs and numerical IDs in transaction names by placeholders. ([#1621](https://github.com/getsentry/relay/pull/1621))
- Parse string as number to handle a release bug. ([#1637](https://github.com/getsentry/relay/pull/1637))
- Expand Profiling's discard reasons. ([#1661](https://github.com/getsentry/relay/pull/1661))
- Expand Profiling's discard reasons. ([#1661](https://github.com/getsentry/relay/pull/1661), [#1685](https://github.com/getsentry/relay/pull/1685))
- Allow to rate limit profiles on top of transactions. ([#1681](https://github.com/getsentry/relay/pull/1681))

## 22.11.0
Expand Down
4 changes: 3 additions & 1 deletion relay-profiling/src/outcomes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@ use crate::ProfileError;
pub fn discard_reason(err: ProfileError) -> &'static str {
match err {
ProfileError::CannotSerializePayload => "profiling_failed_serialization",
ProfileError::InvalidBase64Value => "profiling_invalid_base64_value",
ProfileError::InvalidJson(_) => "profiling_invalid_json",
Copy link
Member

Choose a reason for hiding this comment

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

We should use the existing discard reasons for this, such as DiscardReason::InvalidJson to keep cardinality of the column overall as low as possible. However, we can also follow up about this.

ProfileError::InvalidSampledProfile => "profiling_invalid_sampled_profile",
ProfileError::InvalidTransactionMetadata => "profiling_invalid_transaction_metadata",
ProfileError::MalformedSamples => "profiling_malformed_samples",
ProfileError::MalformedStacks => "profiling_malformed_stacks",
ProfileError::MissingProfileMetadata => "profiling_invalid_profile_metadata",
ProfileError::NoTransactionAssociated => "profiling_no_transaction_associated",
ProfileError::NotEnoughSamples => "profiling_not_enough_samples",
ProfileError::PlatformNotSupported => "profiling_platform_not_supported",
_ => "profiling_unknown",
}
}
2 changes: 1 addition & 1 deletion relay-server/src/actors/processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -964,7 +964,7 @@ impl EnvelopeProcessorService {
Err(err) => {
match err {
relay_profiling::ProfileError::InvalidJson(_) => {
relay_log::error!("invalid profile: {}", LogError(&err));
relay_log::warn!("invalid profile: {}", LogError(&err));
}
_ => relay_log::debug!("invalid profile: {}", err),
};
Expand Down