Update readme example
This commit is contained in:
parent
2e77029b50
commit
d8f1f2e6f6
|
@ -1,7 +1,7 @@
|
||||||
[package]
|
[package]
|
||||||
name = "tracing-awc"
|
name = "tracing-awc"
|
||||||
description = "Tracing instrumentation for the awc http client"
|
description = "Tracing instrumentation for the awc http client"
|
||||||
version = "0.1.1"
|
version = "0.1.2"
|
||||||
authors = ["asonix <asonix@asonix.dog"]
|
authors = ["asonix <asonix@asonix.dog"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
license = "AGPL-3.0"
|
license = "AGPL-3.0"
|
||||||
|
|
|
@ -14,11 +14,16 @@ tracing-awc = { version = "0.1.0", features = ["opentelemetry_0_17"]
|
||||||
```rust
|
```rust
|
||||||
use awc::Client;
|
use awc::Client;
|
||||||
use std::error::Error;
|
use std::error::Error;
|
||||||
use tracing_awc::{root_span, Propagate};
|
use tracing_awc::{root_span, Tracing};
|
||||||
use tracing_futures::Instrument;
|
use tracing_futures::Instrument;
|
||||||
|
|
||||||
async fn request(url: &str) -> Result<(), Box<dyn Error>> {
|
async fn request(url: &str) -> Result<(), Box<dyn Error>> {
|
||||||
Client::new().get(url).propagate().send().await?;
|
Client::builder()
|
||||||
|
.wrap(Tracing)
|
||||||
|
.finish()
|
||||||
|
.get(url)
|
||||||
|
.send()
|
||||||
|
.await?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue