Skip to content

Commit 3923997

Browse files
committed
Fix compilation when the tracing_instrument feature is enabled (#3110)
1 parent 38ac76b commit 3923997

File tree

11 files changed

+22
-1
lines changed

11 files changed

+22
-1
lines changed

src/cache/mod.rs

+2
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ use dashmap::DashMap;
3737
#[cfg(feature = "temp_cache")]
3838
use mini_moka::sync::Cache as MokaCache;
3939
use parking_lot::RwLock;
40+
#[cfg(feature = "tracing_instrument")]
41+
use tracing::instrument;
4042

4143
pub use self::cache_update::CacheUpdate;
4244
pub use self::settings::Settings;

src/error.rs

+2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ use std::io::Error as IoError;
66
use reqwest::{header::InvalidHeaderValue, Error as ReqwestError};
77
#[cfg(feature = "gateway")]
88
use tokio_tungstenite::tungstenite::error::Error as TungsteniteError;
9+
#[cfg(feature = "tracing_instrument")]
10+
use tracing::instrument;
911

1012
#[cfg(feature = "gateway")]
1113
use crate::gateway::GatewayError;

src/gateway/client/mod.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ use std::time::Duration;
3838
use futures::channel::mpsc::UnboundedReceiver as Receiver;
3939
use futures::future::BoxFuture;
4040
use futures::StreamExt as _;
41+
#[cfg(feature = "tracing_instrument")]
42+
use tracing::instrument;
4143
use tracing::{debug, warn};
4244

4345
pub use self::context::Context;
@@ -294,7 +296,6 @@ impl IntoFuture for ClientBuilder {
294296

295297
type IntoFuture = BoxFuture<'static, Result<Client>>;
296298

297-
#[cfg_attr(feature = "tracing_instrument", instrument(skip(self)))]
298299
fn into_future(self) -> Self::IntoFuture {
299300
let data = self.data.unwrap_or(Arc::new(()));
300301
#[cfg(feature = "framework")]

src/gateway/sharding/mod.rs

+2
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ use aformat::{aformat, ArrayString, CapStr};
5050
use serde::Deserialize;
5151
use tokio_tungstenite::tungstenite::error::Error as TungsteniteError;
5252
use tokio_tungstenite::tungstenite::protocol::frame::CloseFrame;
53+
#[cfg(feature = "tracing_instrument")]
54+
use tracing::instrument;
5355
use tracing::{debug, error, info, trace, warn};
5456
use url::Url;
5557

src/gateway/sharding/shard_manager.rs

+2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ use futures::channel::mpsc::{self, UnboundedReceiver as Receiver, UnboundedSende
99
use futures::{SinkExt, StreamExt};
1010
use tokio::sync::Mutex;
1111
use tokio::time::timeout;
12+
#[cfg(feature = "tracing_instrument")]
13+
use tracing::instrument;
1214
use tracing::{info, warn};
1315

1416
use super::{

src/gateway/sharding/shard_queuer.rs

+2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ use futures::channel::mpsc::UnboundedReceiver as Receiver;
88
use futures::StreamExt;
99
use tokio::sync::Mutex;
1010
use tokio::time::{sleep, timeout, Duration, Instant};
11+
#[cfg(feature = "tracing_instrument")]
12+
use tracing::instrument;
1113
use tracing::{debug, info, warn};
1214

1315
use super::{

src/gateway/sharding/shard_runner.rs

+2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ use tokio_tungstenite::tungstenite;
55
use tokio_tungstenite::tungstenite::error::Error as TungsteniteError;
66
use tokio_tungstenite::tungstenite::protocol::frame::CloseFrame;
77
use tokio_tungstenite::tungstenite::Message;
8+
#[cfg(feature = "tracing_instrument")]
9+
use tracing::instrument;
810
use tracing::{debug, error, info, trace, warn};
911

1012
#[cfg(feature = "collector")]

src/gateway/ws.rs

+2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ use tokio::time::{timeout, Duration};
1313
use tokio_tungstenite::tungstenite::protocol::{CloseFrame, WebSocketConfig};
1414
use tokio_tungstenite::tungstenite::{Error as WsError, Message};
1515
use tokio_tungstenite::{connect_async_with_config, MaybeTlsStream, WebSocketStream};
16+
#[cfg(feature = "tracing_instrument")]
17+
use tracing::instrument;
1618
use tracing::{debug, trace, warn};
1719
use url::Url;
1820
#[cfg(feature = "transport_compression_zstd")]

src/http/client.rs

+2
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ use serde::de::DeserializeOwned;
1515
use serde::ser::SerializeSeq as _;
1616
use serde_json::{from_value, to_string, to_vec};
1717
use to_arraystring::ToArrayString as _;
18+
#[cfg(feature = "tracing_instrument")]
19+
use tracing::instrument;
1820
use tracing::{debug, warn};
1921

2022
use super::multipart::{Multipart, MultipartUpload};

src/http/ratelimiting.rs

+2
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ use reqwest::{Client, Response, StatusCode};
4646
use tokio::sync::Mutex;
4747
use tokio::time::{sleep, Duration};
4848
use tracing::debug;
49+
#[cfg(feature = "tracing_instrument")]
50+
use tracing::instrument;
4951

5052
pub use super::routing::RatelimitingBucket;
5153
use super::{HttpError, LightMethod, Request};

src/http/request.rs

+2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ use reqwest::header::{
99
USER_AGENT,
1010
};
1111
use reqwest::{Client, RequestBuilder as ReqwestRequestBuilder};
12+
#[cfg(feature = "tracing_instrument")]
13+
use tracing::instrument;
1214

1315
use super::multipart::Multipart;
1416
use super::routing::Route;

0 commit comments

Comments
 (0)