Skip to content

Commit 1bc540c

Browse files
committed
Changelog for switching periodreader default
1 parent 3df15a1 commit 1bc540c

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

opentelemetry-sdk/CHANGELOG.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,43 @@
2424
Migration Guidance:
2525
- These methods were intended for log appenders. Keep the clone of the provider handle, instead of depending on above methods.
2626

27+
- *Breaking* - `PeriodicReader` Updates
28+
29+
`PeriodicReader` no longer requires an async runtime by default. Instead, it now creates its own background thread for execution. This change allows metrics to be used in environments without async runtimes.
30+
31+
For users who prefer the previous behavior of relying on a specific `Runtime`, they can do so by enabling the feature flag **`experimental_metrics_periodicreader_with_async_runtime`**.
32+
33+
Migration Guide:
34+
35+
1. *Default Implementation, requires no async runtime* (**Recommended**)
36+
The new default implementation does not require a runtime argument. Replace the builder method accordingly:
37+
- *Before:*
38+
```rust
39+
let reader = PeriodicReader::builder(exporter, runtime::Tokio).build();
40+
```
41+
- *After:*
42+
```rust
43+
let reader = PeriodicReader::builder(exporter).build();
44+
```
45+
46+
2. *Async Runtime Support*
47+
If your application cannot spin up new threads or you prefer using async runtimes, update your code and enable the required feature flags.
48+
49+
- *Before:*
50+
```rust
51+
let reader = PeriodicReader::builder(exporter, runtime::Tokio).build();
52+
```
53+
- *After:*
54+
```rust
55+
let reader = PeriodicReader::builder(exporter)
56+
.with_runtime(runtime::Tokio)
57+
.build();
58+
```
59+
60+
*Requirements:*
61+
- Enable the feature flag: `experimental_metrics_periodicreader_with_async_runtime`.
62+
- Enable one of the async runtime feature flags: `rt-tokio`, `rt-tokio-current-thread`, or `rt-async-std`.
63+
2764
## 0.27.1
2865

2966
Released 2024-Nov-27

0 commit comments

Comments
 (0)