Skip to content

Commit

Permalink
fix(profiles): Bump android-trace-log version to prevent panic (#2457)
Browse files Browse the repository at this point in the history
  • Loading branch information
jjbayer authored Sep 4, 2023
1 parent a0c3d71 commit d6e110b
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 12 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
- Fixes the `TraceContext.status` not being defaulted to `unknown` before the new metrics extraction pipeline. ([#2436](https://github.com/getsentry/relay/pull/2436))
- Support on-demand metrics for alerts and widgets in external Relays. ([#2440](https://github.com/getsentry/relay/pull/2440))
- Prevent sporadic data loss in `EnvelopeProcessorService`. ([#2454](https://github.com/getsentry/relay/pull/2454))
- Prevent panic when android trace contains invalid start time. ([#2457](https://github.com/getsentry/relay/pull/2457))

**Internal**:

Expand Down
18 changes: 12 additions & 6 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ debug = true

[workspace.dependencies]
anyhow = "1.0.66"
chrono = { version = "0.4.24", default-features = false, features = [
chrono = { version = "0.4.28", default-features = false, features = [
"std",
"serde",
] }
Expand Down
3 changes: 2 additions & 1 deletion relay-common/src/time.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,8 @@ impl UnixTimestamp {

/// Returns the timestamp as chrono datetime.
pub fn as_datetime(self) -> Option<DateTime<Utc>> {
NaiveDateTime::from_timestamp_opt(self.0 as i64, 0).map(|n| DateTime::from_utc(n, Utc))
NaiveDateTime::from_timestamp_opt(self.0 as i64, 0)
.map(|n| DateTime::from_naive_utc_and_offset(n, Utc))
}

/// Converts the UNIX timestamp into an `Instant` based on the current system timestamp.
Expand Down
4 changes: 2 additions & 2 deletions relay-event-normalization/src/transactions/rules.rs
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ mod tests {
let parsed_time = DateTime::parse_from_rfc3339("2022-11-30T00:00:00Z").unwrap();
let result = TransactionNameRule {
pattern: LazyGlob::new("/auth/login/*/**".to_string()),
expiry: DateTime::from_utc(parsed_time.naive_utc(), Utc),
expiry: DateTime::from_naive_utc_and_offset(parsed_time.naive_utc(), Utc),
redaction: RedactionRule::Replace {
substitution: String::from(":id"),
},
Expand All @@ -220,7 +220,7 @@ mod tests {
let parsed_time = DateTime::parse_from_rfc3339("2022-11-30T00:00:00Z").unwrap();
let result = TransactionNameRule {
pattern: LazyGlob::new("/auth/login/*/**".to_string()),
expiry: DateTime::from_utc(parsed_time.naive_utc(), Utc),
expiry: DateTime::from_naive_utc_and_offset(parsed_time.naive_utc(), Utc),
redaction: RedactionRule::Replace {
substitution: default_substitution(),
},
Expand Down
2 changes: 1 addition & 1 deletion relay-event-schema/src/protocol/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1016,7 +1016,7 @@ impl FromValue for Timestamp {
Annotated(Some(Value::String(value)), mut meta) => {
// NaiveDateTime parses "%Y-%m-%dT%H:%M:%S%.f"
let parsed = match value.parse::<NaiveDateTime>() {
Ok(dt) => Ok(DateTime::from_utc(dt, Utc)),
Ok(dt) => Ok(DateTime::from_naive_utc_and_offset(dt, Utc)),

// XXX: This actually accepts more than RFC 3339. SDKs are strongly discouraged
// from exercising that freedom. We should only support RFC3339.
Expand Down
2 changes: 1 addition & 1 deletion relay-profiling/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ license-file = "../LICENSE"
publish = false

[dependencies]
android_trace_log = { version = "0.2.0", features = ["serde"] }
android_trace_log = { version = "0.3.0", features = ["serde"] }
chrono = { workspace = true }
data-encoding = "2.3.3"
relay-event-schema = { path = "../relay-event-schema" }
Expand Down

0 comments on commit d6e110b

Please sign in to comment.