58
58
** ` experimental_metrics_periodicreader_with_async_runtime ` ** .
59
59
60
60
Migration Guide:
61
-
62
- 1 . * Default Implementation, requires no async runtime* (** Recommended** ) The
61
+ 1 . * Default Implementation, requires no async runtime* (** Recommended** ) The
63
62
new default implementation does not require a runtime argument. Replace the
64
63
builder method accordingly:
65
- - * Before:*
64
+ - * Before:*
66
65
``` rust
67
66
let reader = opentelemetry_sdk :: metrics :: PeriodicReader :: builder (exporter , runtime :: Tokio ). build ();
68
67
```
71
70
let reader = opentelemetry_sdk :: metrics :: PeriodicReader :: builder (exporter ). build ();
72
71
```
73
72
73
+ The new PeriodicReader can be used with OTLP Exporter , and supports
74
+ following exporter features :
75
+ - `grpc - tonic `: This requires `MeterProvider ` to be created within a tokio
76
+ runtime .
77
+ - `reqwest - blocking - client `: Works with a regular `main ` or `tokio :: main `.
78
+
79
+ In other words , other clients like `reqwest ` and `hyper ` are not supported .
80
+
74
81
2 . * Async Runtime Support *
75
82
If your application cannot spin up new threads or you prefer using async
76
83
runtimes , enable the
77
84
" experimental_metrics_periodicreader_with_async_runtime" feature flag and
78
85
adjust code as below .
79
86
80
87
- * Before : *
88
+
81
89
```rust
82
90
let reader = opentelemetry_sdk :: metrics :: PeriodicReader :: builder (exporter , runtime :: Tokio ). build ();
83
91
```
84
92
85
93
- * After : *
94
+
86
95
```rust
87
96
let reader = opentelemetry_sdk :: metrics :: periodic_reader_with_async_runtime :: PeriodicReader :: builder (exporter , runtime :: Tokio ). build ();
88
- ```
97
+ ```
89
98
90
99
* Requirements : *
91
100
- Enable the feature flag :
104
113
- Getter methods have been introduced to access field values .
105
114
This change impacts custom exporter and processor developers by requiring updates to code that directly accessed LogRecord fields . They must now use the provided getter methods (e. g. , `log_record. event_name()` instead of `log_record. event_name`).
106
115
107
- - Upgrade the tracing crate used for internal logging to version 0. 1. 40 or later. This is necessary because the internal logging macros utilize the name field as
116
+ - Upgrade the tracing crate used for internal logging to version 0. 1. 40 or later. This is necessary because the internal logging macros utilize the name field as
108
117
metadata, a feature introduced in version 0. 1. 40. [#2418](https: // github.com/open-telemetry/opentelemetry-rust/pull/2418)
109
118
110
- - * * Breaking ** [#2436](https: // github.com/open-telemetry/opentelemetry-rust/pull/2436)
111
-
119
+ - * Breaking * - `BatchLogProcessor ` Updates [#2436](https: // github.com/open-telemetry/opentelemetry-rust/pull/2436)
112
120
`BatchLogProcessor ` no longer requires an async runtime by default. Instead , a dedicated
113
121
background thread is created to do the batch processing and exporting.
114
122
@@ -120,33 +128,45 @@ metadata, a feature introduced in version 0.1.40. [#2418](https://github.com/ope
120
128
new default implementation does not require a runtime argument. Replace the
121
129
builder method accordingly:
122
130
- * Before : *
131
+
123
132
```rust
124
133
let logger_provider = LoggerProvider :: builder()
125
134
. with_log_processor(BatchLogProcessor :: builder(exporter, runtime :: Tokio ). build())
126
135
. build();
127
136
```
128
137
129
138
- * After : *
139
+
130
140
```rust
131
141
let logger_provider = LoggerProvider :: builder ()
132
142
. with_log_processor (BatchLogProcessor :: builder (exporter ). build ())
133
143
. build ();
134
144
```
135
145
146
+ The new BatchLogProcessor can be used with OTLP Exporter , and supports
147
+ following exporter features :
148
+ - `grpc - tonic `: This requires `MeterProvider ` to be created within a tokio
149
+ runtime .
150
+ - `reqwest - blocking - client `: Works with a regular `main ` or `tokio :: main `.
151
+
152
+ In other words , other clients like `reqwest ` and `hyper ` are not supported .
153
+
136
154
2 . * Async Runtime Support *
137
155
If your application cannot spin up new threads or you prefer using async
138
156
runtimes , enable the
139
157
" experimental_logs_batch_log_processor_with_async_runtime" feature flag and
140
158
adjust code as below .
141
159
142
160
- * Before : *
161
+
143
162
```rust
144
163
let logger_provider = LoggerProvider :: builder ()
145
164
. with_log_processor (BatchLogProcessor :: builder (exporter , runtime :: Tokio ). build ())
146
165
. build ();
147
166
```
148
167
149
168
- * After : *
169
+
150
170
```rust
151
171
let logger_provider = LoggerProvider :: builder ()
152
172
. with_log_processor (log_processor_with_async_runtime :: BatchLogProcessor :: builder (exporter , runtime :: Tokio ). build ())
@@ -159,7 +179,7 @@ metadata, a feature introduced in version 0.1.40. [#2418](https://github.com/ope
159
179
- Continue enabling one of the async runtime feature flags : `rt - tokio `,
160
180
`rt - tokio - current - thread `, or `rt - async - std `.
161
181
162
- - * * Breaking ** [# 2456 ](https : // github.com/open-telemetry/opentelemetry-rust/pull/2456)
182
+ - * Breaking * - ` BatchSpanProcessor ` Updates [# 2435 ](https : // github.com/open-telemetry/opentelemetry-rust/pull/2456)
163
183
164
184
`BatchSpanProcessor ` no longer requires an async runtime by default . Instead , a dedicated
165
185
background thread is created to do the batch processing and exporting .
@@ -172,33 +192,45 @@ metadata, a feature introduced in version 0.1.40. [#2418](https://github.com/ope
172
192
new default implementation does not require a runtime argument . Replace the
173
193
builder method accordingly :
174
194
- * Before : *
195
+
175
196
```rust
176
197
let tracer_provider = TracerProvider :: builder ()
177
198
. with_span_processor (BatchSpanProcessor :: builder (exporter , runtime :: Tokio ). build ())
178
199
. build ();
179
200
```
180
201
181
202
- * After : *
203
+
182
204
```rust
183
205
let tracer_provider = TracerProvider :: builder ()
184
206
. with_span_processor (BatchSpanProcessor :: builder (exporter ). build ())
185
207
. build ();
186
208
```
187
209
210
+ The new BatchLogProcessor can be used with OTLP Exporter , and supports
211
+ following exporter features :
212
+ - `grpc - tonic `: This requires `MeterProvider ` to be created within a tokio
213
+ runtime .
214
+ - `reqwest - blocking - client `: Works with a regular `main ` or `tokio :: main `.
215
+
216
+ In other words , other clients like `reqwest ` and `hyper ` are not supported .
217
+
188
218
2 . * Async Runtime Support *
189
219
If your application cannot spin up new threads or you prefer using async
190
220
runtimes , enable the
191
221
" experimental_trace_batch_span_processor_with_async_runtime" feature flag and
192
222
adjust code as below .
193
223
194
224
- * Before : *
225
+
195
226
```rust
196
227
let tracer_provider = TracerProvider :: builder ()
197
228
. with_span_processor (BatchSpanProcessor :: builder (exporter , runtime :: Tokio ). build ())
198
229
. build ();
199
230
```
200
231
201
232
- * After : *
233
+
202
234
```rust
203
235
let tracer_provider = TracerProvider :: builder ()
204
236
. with_span_processor (span_processor_with_async_runtime :: BatchSpanProcessor :: builder (exporter , runtime :: Tokio ). build ())
0 commit comments