Skip to content
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
996 changes: 977 additions & 19 deletions Cargo.lock

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions sentry-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,12 @@ UNSTABLE_cadence = ["dep:cadence", "UNSTABLE_metrics"]

[dependencies]
cadence = { version = "0.29.0", optional = true }
crc32fast = "1.4.0"
itertools = "0.13.0"
Copy link
Member

Choose a reason for hiding this comment

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

are we still using this?

Copy link
Contributor Author

@elramen elramen May 27, 2024

Choose a reason for hiding this comment

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

Yes, crc32 is used for hashing set values and itertools is used for sorting and joining the metric tags! :)

Copy link
Member

Choose a reason for hiding this comment

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

similar to #659, we should make both these dependencies optional.
Also instead of manually sorting the metric tags, how about you switch to a BTreeMap which is sorted by definition?

log = { version = "0.4.8", optional = true, features = ["std"] }
once_cell = "1"
rand = { version = "0.8.1", optional = true }
regex = "1.7.3"
sentry-types = { version = "0.32.3", path = "../sentry-types" }
serde = { version = "1.0.104", features = ["derive"] }
serde_json = { version = "1.0.46" }
Expand Down
7 changes: 4 additions & 3 deletions sentry-core/src/cadence.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,10 @@ mod tests {

println!("{metrics}");

assert!(metrics.contains("sentry.test.count.with.tags:1|c|#foo:bar|T"));
assert!(metrics.contains("sentry.test.some.count:11|c|T"));
assert!(metrics.contains("sentry.test.some.distr:1:2:3|d|T"));
assert!(metrics
.contains("sentry.test.count.with.tags@none:1|c|#environment:production,foo:bar|T"));
assert!(metrics.contains("sentry.test.some.count@none:11|c|#environment:production|T"));
assert!(metrics.contains("sentry.test.some.distr@none:1:2:3|d|#environment:production|T"));
assert_eq!(items.next(), None);
}
}
6 changes: 3 additions & 3 deletions sentry-core/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -207,13 +207,13 @@ impl Client {
}

if event.release.is_none() {
event.release = self.options.release.clone();
event.release.clone_from(&self.options.release);
}
if event.environment.is_none() {
event.environment = self.options.environment.clone();
event.environment.clone_from(&self.options.environment);
}
if event.server_name.is_none() {
event.server_name = self.options.server_name.clone();
event.server_name.clone_from(&self.options.server_name);
}
if &event.platform == "other" {
event.platform = "native".into();
Expand Down
Loading