Skip to content

Commit

Permalink
Fix compilation when the tracing_instrument feature is enabled (ser…
Browse files Browse the repository at this point in the history
  • Loading branch information
mkrasnitski authored Feb 11, 2025
1 parent 7fd21be commit f160b50
Show file tree
Hide file tree
Showing 11 changed files with 22 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/cache/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ use dashmap::DashMap;
#[cfg(feature = "temp_cache")]
use mini_moka::sync::Cache as MokaCache;
use parking_lot::RwLock;
#[cfg(feature = "tracing_instrument")]
use tracing::instrument;

pub use self::cache_update::CacheUpdate;
pub use self::settings::Settings;
Expand Down
2 changes: 2 additions & 0 deletions src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ use std::io::Error as IoError;
use reqwest::{header::InvalidHeaderValue, Error as ReqwestError};
#[cfg(feature = "gateway")]
use tokio_tungstenite::tungstenite::error::Error as TungsteniteError;
#[cfg(feature = "tracing_instrument")]
use tracing::instrument;

#[cfg(feature = "gateway")]
use crate::gateway::GatewayError;
Expand Down
3 changes: 2 additions & 1 deletion src/gateway/client/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ use std::time::Duration;
use futures::channel::mpsc::UnboundedReceiver as Receiver;
use futures::future::BoxFuture;
use futures::StreamExt as _;
#[cfg(feature = "tracing_instrument")]
use tracing::instrument;
use tracing::{debug, warn};

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

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

#[cfg_attr(feature = "tracing_instrument", instrument(skip(self)))]
fn into_future(self) -> Self::IntoFuture {
let data = self.data.unwrap_or(Arc::new(()));
#[cfg(feature = "framework")]
Expand Down
2 changes: 2 additions & 0 deletions src/gateway/sharding/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ use aformat::{aformat, ArrayString, CapStr};
use serde::Deserialize;
use tokio_tungstenite::tungstenite::error::Error as TungsteniteError;
use tokio_tungstenite::tungstenite::protocol::frame::CloseFrame;
#[cfg(feature = "tracing_instrument")]
use tracing::instrument;
use tracing::{debug, error, info, trace, warn};
use url::Url;

Expand Down
2 changes: 2 additions & 0 deletions src/gateway/sharding/shard_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ use futures::channel::mpsc::{self, UnboundedReceiver as Receiver, UnboundedSende
use futures::{SinkExt, StreamExt};
use tokio::sync::Mutex;
use tokio::time::timeout;
#[cfg(feature = "tracing_instrument")]
use tracing::instrument;
use tracing::{info, warn};

use super::{
Expand Down
2 changes: 2 additions & 0 deletions src/gateway/sharding/shard_queuer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ use futures::channel::mpsc::UnboundedReceiver as Receiver;
use futures::StreamExt;
use tokio::sync::Mutex;
use tokio::time::{sleep, timeout, Duration, Instant};
#[cfg(feature = "tracing_instrument")]
use tracing::instrument;
use tracing::{debug, info, warn};

use super::{
Expand Down
2 changes: 2 additions & 0 deletions src/gateway/sharding/shard_runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ use tokio_tungstenite::tungstenite;
use tokio_tungstenite::tungstenite::error::Error as TungsteniteError;
use tokio_tungstenite::tungstenite::protocol::frame::CloseFrame;
use tokio_tungstenite::tungstenite::Message;
#[cfg(feature = "tracing_instrument")]
use tracing::instrument;
use tracing::{debug, error, info, trace, warn};

#[cfg(feature = "collector")]
Expand Down
2 changes: 2 additions & 0 deletions src/gateway/ws.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ use tokio::time::{timeout, Duration};
use tokio_tungstenite::tungstenite::protocol::{CloseFrame, WebSocketConfig};
use tokio_tungstenite::tungstenite::{Error as WsError, Message};
use tokio_tungstenite::{connect_async_with_config, MaybeTlsStream, WebSocketStream};
#[cfg(feature = "tracing_instrument")]
use tracing::instrument;
use tracing::{debug, trace, warn};
use url::Url;
#[cfg(feature = "transport_compression_zstd")]
Expand Down
2 changes: 2 additions & 0 deletions src/http/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ use serde::de::DeserializeOwned;
use serde::ser::SerializeSeq as _;
use serde_json::{from_value, to_string, to_vec};
use to_arraystring::ToArrayString as _;
#[cfg(feature = "tracing_instrument")]
use tracing::instrument;
use tracing::{debug, warn};

use super::multipart::{Multipart, MultipartUpload};
Expand Down
2 changes: 2 additions & 0 deletions src/http/ratelimiting.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ use reqwest::{Client, Response, StatusCode};
use tokio::sync::Mutex;
use tokio::time::{sleep, Duration};
use tracing::debug;
#[cfg(feature = "tracing_instrument")]
use tracing::instrument;

pub use super::routing::RatelimitingBucket;
use super::{HttpError, LightMethod, Request};
Expand Down
2 changes: 2 additions & 0 deletions src/http/request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ use reqwest::header::{
USER_AGENT,
};
use reqwest::{Client, RequestBuilder as ReqwestRequestBuilder};
#[cfg(feature = "tracing_instrument")]
use tracing::instrument;

use super::multipart::Multipart;
use super::routing::Route;
Expand Down

0 comments on commit f160b50

Please sign in to comment.