Skip to content

Commit dc048f5

Browse files
committed
release: 0.28.0
1 parent d390b64 commit dc048f5

File tree

18 files changed

+104
-53
lines changed

18 files changed

+104
-53
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Changelog
22

3-
## Unreleased
3+
## 0.28.0
44

55
**Breaking Changes**:
66

sentry-actix/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "sentry-actix"
3-
version = "0.27.0"
3+
version = "0.28.0"
44
authors = ["Sentry <hello@sentry.io>"]
55
license = "Apache-2.0"
66
readme = "README.md"
@@ -15,7 +15,7 @@ rust-version = "1.60"
1515
[dependencies]
1616
actix-web = { version = "4", default-features = false }
1717
futures-util = { version = "0.3.5", default-features = false }
18-
sentry-core = { version = "0.27.0", path = "../sentry-core", default-features = false, features = ["client"] }
18+
sentry-core = { version = "0.28.0", path = "../sentry-core", default-features = false, features = ["client"] }
1919

2020
[dev-dependencies]
2121
actix-web = { version = "4" }

sentry-anyhow/Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "sentry-anyhow"
3-
version = "0.27.0"
3+
version = "0.28.0"
44
authors = ["Sentry <hello@sentry.io>"]
55
license = "Apache-2.0"
66
readme = "README.md"
@@ -17,8 +17,8 @@ default = ["backtrace"]
1717
backtrace = ["anyhow/backtrace"]
1818

1919
[dependencies]
20-
sentry-backtrace = { version = "0.27.0", path = "../sentry-backtrace" }
21-
sentry-core = { version = "0.27.0", path = "../sentry-core" }
20+
sentry-backtrace = { version = "0.28.0", path = "../sentry-backtrace" }
21+
sentry-core = { version = "0.28.0", path = "../sentry-core" }
2222
anyhow = "1.0.39"
2323

2424
[dev-dependencies]

sentry-backtrace/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "sentry-backtrace"
3-
version = "0.27.0"
3+
version = "0.28.0"
44
authors = ["Sentry <hello@sentry.io>"]
55
license = "Apache-2.0"
66
readme = "README.md"
@@ -16,4 +16,4 @@ rust-version = "1.60"
1616
backtrace = "0.3.44"
1717
once_cell = "1"
1818
regex = "1.5.5"
19-
sentry-core = { version = "0.27.0", path = "../sentry-core" }
19+
sentry-core = { version = "0.28.0", path = "../sentry-core" }

sentry-contexts/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "sentry-contexts"
3-
version = "0.27.0"
3+
version = "0.28.0"
44
authors = ["Sentry <hello@sentry.io>"]
55
license = "Apache-2.0"
66
readme = "README.md"
@@ -14,7 +14,7 @@ edition = "2021"
1414
rust-version = "1.60"
1515

1616
[dependencies]
17-
sentry-core = { version = "0.27.0", path = "../sentry-core" }
17+
sentry-core = { version = "0.28.0", path = "../sentry-core" }
1818
libc = "0.2.66"
1919
hostname = "0.3.0"
2020

sentry-core/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "sentry-core"
3-
version = "0.27.0"
3+
version = "0.28.0"
44
authors = ["Sentry <hello@sentry.io>"]
55
license = "Apache-2.0"
66
readme = "README.md"
@@ -33,7 +33,7 @@ frame-pointer = ["pprof?/frame-pointer"]
3333
log = { version = "0.4.8", optional = true, features = ["std"] }
3434
once_cell = "1"
3535
rand = { version = "0.8.1", optional = true }
36-
sentry-types = { version = "0.27.0", path = "../sentry-types" }
36+
sentry-types = { version = "0.28.0", path = "../sentry-types" }
3737
serde = { version = "1.0.104", features = ["derive"] }
3838
serde_json = { version = "1.0.46" }
3939
uuid = { version = "1.0.0", features = ["v4", "serde"], optional = true }

sentry-core/README.md

Lines changed: 57 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,62 @@ This crate follows the [Unified API] guidelines and is centered around
2222
the concepts of [`Client`], [`Hub`] and [`Scope`], as well as the extension
2323
points via the [`Integration`], [`Transport`] and [`TransportFactory`] traits.
2424

25+
## Parallelism, Concurrency and Async
26+
27+
The main concurrency primitive is the [`Hub`]. In general, all concurrent
28+
code, no matter if multithreaded parallelism or futures concurrency, needs
29+
to run with its own copy of a [`Hub`]. Even though the [`Hub`] is internally
30+
synchronized, using it concurrently may lead to unexpected results up to
31+
panics.
32+
33+
For threads or tasks that are running concurrently or outlive the current
34+
execution context, a new [`Hub`] needs to be created and bound for the computation.
35+
36+
```rust
37+
use rayon::prelude::*;
38+
use sentry::{Hub, SentryFutureExt};
39+
use std::sync::Arc;
40+
41+
// Parallel multithreaded code:
42+
let outer_hub = Hub::current();
43+
let results: Vec<_> = [1_u32, 2, 3]
44+
.into_par_iter()
45+
.map(|num| {
46+
let thread_hub = Arc::new(Hub::new_from_top(&outer_hub));
47+
Hub::run(thread_hub, || num * num)
48+
})
49+
.collect();
50+
51+
assert_eq!(&results, &[1, 4, 9]);
52+
53+
// Concurrent futures code:
54+
let futures = [1_u32, 2, 3]
55+
.into_iter()
56+
.map(|num| async move { num * num }.bind_hub(Hub::new_from_top(Hub::current())));
57+
let results = futures::future::join_all(futures).await;
58+
59+
assert_eq!(&results, &[1, 4, 9]);
60+
```
61+
62+
For tasks that are not concurrent and do not outlive the current execution
63+
context, no *new* [`Hub`] needs to be created, but the current [`Hub`] has
64+
to be bound.
65+
66+
```rust
67+
use sentry::{Hub, SentryFutureExt};
68+
69+
// Spawned thread that is being joined:
70+
let hub = Hub::current();
71+
let result = std::thread::spawn(|| Hub::run(hub, || 1_u32)).join();
72+
73+
assert_eq!(result.unwrap(), 1);
74+
75+
// Spawned future that is being awaited:
76+
let result = tokio::spawn(async { 1_u32 }.bind_hub(Hub::current())).await;
77+
78+
assert_eq!(result.unwrap(), 1);
79+
```
80+
2581
## Minimal API
2682

2783
By default, this crate comes with a so-called "minimal" mode. This mode will
@@ -46,13 +102,7 @@ functionality.
46102
[Sentry]: https://sentry.io/
47103
[`sentry`]: https://crates.io/crates/sentry
48104
[Unified API]: https://develop.sentry.dev/sdk/unified-api/
49-
[`Client`]: https://docs.rs/sentry-core/0.27.0/sentry_core/struct.Client.html
50-
[`Hub`]: https://docs.rs/sentry-core/0.27.0/sentry_core/struct.Hub.html
51-
[`Scope`]: https://docs.rs/sentry-core/0.27.0/sentry_core/struct.Scope.html
52-
[`Integration`]: https://docs.rs/sentry-core/0.27.0/sentry_core/trait.Integration.html
53-
[`Transport`]: https://docs.rs/sentry-core/0.27.0/sentry_core/trait.Transport.html
54-
[`TransportFactory`]: https://docs.rs/sentry-core/0.27.0/sentry_core/trait.TransportFactory.html
55-
[`test`]: https://docs.rs/sentry-core/0.27.0/sentry_core/test/index.html
105+
[`test`]: https://docs.rs/sentry-core/0.28.0/sentry_core/test/index.html
56106

57107
## Resources
58108

sentry-debug-images/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "sentry-debug-images"
3-
version = "0.27.0"
3+
version = "0.28.0"
44
authors = ["Sentry <hello@sentry.io>"]
55
license = "Apache-2.0"
66
readme = "README.md"
@@ -15,4 +15,4 @@ rust-version = "1.60"
1515
[dependencies]
1616
findshlibs = "=0.10.2"
1717
once_cell = "1"
18-
sentry-core = { version = "0.27.0", path = "../sentry-core" }
18+
sentry-core = { version = "0.28.0", path = "../sentry-core" }

sentry-debug-images/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ let integration = sentry_debug_images::DebugImagesIntegration::new()
2222
.filter(|event| event.level >= Level::Warning);
2323
```
2424

25-
[`Event`]: https://docs.rs/sentry-debug-images/0.27.0/sentry_debug-images/sentry_core::protocol::Event
25+
[`Event`]: https://docs.rs/sentry-debug-images/0.28.0/sentry_debug_images/sentry_core::protocol::Event
2626

2727
## Resources
2828

sentry-log/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "sentry-log"
3-
version = "0.27.0"
3+
version = "0.28.0"
44
authors = ["Sentry <hello@sentry.io>"]
55
license = "Apache-2.0"
66
readme = "README.md"
@@ -13,7 +13,7 @@ edition = "2021"
1313
rust-version = "1.60"
1414

1515
[dependencies]
16-
sentry-core = { version = "0.27.0", path = "../sentry-core" }
16+
sentry-core = { version = "0.28.0", path = "../sentry-core" }
1717
log = { version = "0.4.8", features = ["std"] }
1818

1919
[dev-dependencies]

0 commit comments

Comments
 (0)