Skip to content

Commit 903fe24

Browse files
authored
Merge branch 'main' into cijothomas/otlp-useragent
2 parents ed300a9 + 097dab9 commit 903fe24

File tree

6 files changed

+13
-42
lines changed

6 files changed

+13
-42
lines changed

opentelemetry-http/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
- Implementation of `Extractor::get_all` for `HeaderExtractor`
66
- Support `HttpClient` implementation for `HyperClient<C>` with custom connectors beyond `HttpConnector`, enabling Unix Domain Socket connections and other custom transports
7+
- Add `reqwest` and `reqwest-blocking` features to enable async and blocking
8+
reqwest HTTP clients
79

810
## 0.30.0
911

opentelemetry-http/Cargo.toml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,10 @@ autobenches = false
1313
[features]
1414
default = ["internal-logs"]
1515
hyper = ["dep:http-body-util", "dep:hyper", "dep:hyper-util", "dep:tokio"]
16-
reqwest-rustls = ["reqwest", "reqwest/rustls-tls-native-roots"]
17-
reqwest-rustls-webpki-roots = ["reqwest", "reqwest/rustls-tls-webpki-roots"]
16+
reqwest = ["dep:reqwest"]
17+
reqwest-blocking = ["dep:reqwest", "reqwest/blocking"]
18+
reqwest-rustls = ["dep:reqwest", "reqwest/rustls-tls-native-roots"]
19+
reqwest-rustls-webpki-roots = ["dep:reqwest", "reqwest/rustls-tls-webpki-roots"]
1820
internal-logs = ["opentelemetry/internal-logs"]
1921

2022
[dependencies]
@@ -25,7 +27,7 @@ http-body-util = { workspace = true, optional = true }
2527
hyper = { workspace = true, optional = true }
2628
hyper-util = { workspace = true, features = ["client-legacy", "http1", "http2"], optional = true }
2729
opentelemetry = { workspace = true, features = ["trace"] }
28-
reqwest = { workspace = true, features = ["blocking"], optional = true }
30+
reqwest = { workspace = true, optional = true }
2931
tokio = { workspace = true, features = ["time"], optional = true }
3032

3133
[lints]

opentelemetry-http/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ mod reqwest {
108108
}
109109

110110
#[cfg(not(target_arch = "wasm32"))]
111+
#[cfg(feature = "reqwest-blocking")]
111112
#[async_trait]
112113
impl HttpClient for reqwest::blocking::Client {
113114
async fn send_bytes(&self, request: Request<Bytes>) -> Result<Response<Bytes>, HttpError> {

opentelemetry-otlp/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ tls-webpki-roots = ["tls", "tonic/tls-webpki-roots"]
8383
# http binary
8484
http-proto = ["prost", "opentelemetry-http", "opentelemetry-proto/gen-tonic-messages", "http", "trace", "metrics"]
8585
http-json = ["serde_json", "prost", "opentelemetry-http", "opentelemetry-proto/gen-tonic-messages", "opentelemetry-proto/with-serde", "http", "trace", "metrics"]
86-
reqwest-blocking-client = ["reqwest/blocking", "opentelemetry-http/reqwest"]
86+
reqwest-blocking-client = ["reqwest/blocking", "opentelemetry-http/reqwest-blocking"]
8787
reqwest-client = ["reqwest", "opentelemetry-http/reqwest"]
8888
reqwest-rustls = ["reqwest", "opentelemetry-http/reqwest-rustls"]
8989
reqwest-rustls-webpki-roots = ["reqwest", "opentelemetry-http/reqwest-rustls-webpki-roots"]

opentelemetry-otlp/src/lib.rs

Lines changed: 3 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
//!
4141
//! // Create a tracer provider with the exporter
4242
//! let tracer_provider = opentelemetry_sdk::trace::SdkTracerProvider::builder()
43-
//! .with_simple_exporter(otlp_exporter)
43+
//! .with_batch_exporter(otlp_exporter)
4444
//! .build();
4545
//!
4646
//! // Set it as the global provider
@@ -83,7 +83,7 @@
8383
//!
8484
//! // Create a tracer provider with the exporter
8585
//! let tracer_provider = opentelemetry_sdk::trace::SdkTracerProvider::builder()
86-
//! .with_simple_exporter(otlp_exporter)
86+
//! .with_batch_exporter(otlp_exporter)
8787
//! .build();
8888
//!
8989
//! // Set it as the global provider
@@ -116,7 +116,7 @@
116116
//! .build()
117117
//! .expect("Failed to create span exporter");
118118
//! opentelemetry_sdk::trace::SdkTracerProvider::builder()
119-
//! .with_simple_exporter(exporter)
119+
//! .with_batch_exporter(exporter)
120120
//! .build()
121121
//! });
122122
//!
@@ -203,40 +203,6 @@
203203
//! `http://localhost:9090`
204204
//! ## Show Logs, Metrics too (TODO)
205205
//!
206-
//! ## Performance
207-
//!
208-
//! For optimal performance, a batch exporting processor is recommended as the simple
209-
//! processor will export each span synchronously on dropping, and is only good
210-
//! for test/debug purposes.
211-
//!
212-
//! ```toml
213-
//! [dependencies]
214-
//! opentelemetry-otlp = { version = "*", features = ["grpc-tonic"] }
215-
//! ```
216-
//!
217-
//! ```no_run
218-
//! # #[cfg(all(feature = "trace", feature = "grpc-tonic"))]
219-
//! # {
220-
//! use opentelemetry::global;
221-
//! use opentelemetry::trace::Tracer;
222-
//!
223-
//! fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync + 'static>> {
224-
//! // First, create a OTLP exporter builder. Configure it as you need.
225-
//! let otlp_exporter = opentelemetry_otlp::SpanExporter::builder().with_tonic().build()?;
226-
//! // Then pass it into provider builder
227-
//! let _ = opentelemetry_sdk::trace::SdkTracerProvider::builder()
228-
//! .with_batch_exporter(otlp_exporter)
229-
//! .build();
230-
//! let tracer = global::tracer("my_tracer");
231-
//! tracer.in_span("doing_work", |cx| {
232-
//! // Traced app logic here...
233-
//! });
234-
//!
235-
//! Ok(())
236-
//! # }
237-
//! }
238-
//! ```
239-
//!
240206
//! [`tokio`]: https://tokio.rs
241207
//!
242208
//! # Feature Flags

opentelemetry-zipkin/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ rustdoc-args = ["--cfg", "docsrs"]
2222

2323
[features]
2424
default = ["reqwest-blocking-client", "reqwest/native-tls"]
25-
reqwest-blocking-client = ["reqwest/blocking", "opentelemetry-http/reqwest"]
25+
reqwest-blocking-client = ["reqwest/blocking", "opentelemetry-http/reqwest-blocking"]
2626
reqwest-client = ["reqwest", "opentelemetry-http/reqwest"]
2727
reqwest-rustls = ["reqwest", "reqwest/rustls-tls-native-roots"]
2828

0 commit comments

Comments
 (0)