Feature gate instrument imports.
This commit is contained in:
parent
78dfd8999d
commit
dd93596818
|
@ -6,7 +6,9 @@ use crate::overwatch::Services;
|
||||||
use crate::services::ServiceData;
|
use crate::services::ServiceData;
|
||||||
use tokio::runtime::Handle;
|
use tokio::runtime::Handle;
|
||||||
use tokio::sync::mpsc::Sender;
|
use tokio::sync::mpsc::Sender;
|
||||||
use tracing::{error, info, instrument};
|
use tracing::{error, info};
|
||||||
|
#[cfg(feature = "instrumentation")]
|
||||||
|
use tracing::instrument;
|
||||||
|
|
||||||
// internal
|
// internal
|
||||||
use crate::services::relay::Relay;
|
use crate::services::relay::Relay;
|
||||||
|
@ -62,7 +64,10 @@ impl OverwatchHandle {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Send an overwatch command to the overwatch runner
|
/// Send an overwatch command to the overwatch runner
|
||||||
#[cfg_attr(feature = "instrumentation", instrument(name = "overwatch-command-send", skip(self)))]
|
#[cfg_attr(
|
||||||
|
feature = "instrumentation",
|
||||||
|
instrument(name = "overwatch-command-send", skip(self))
|
||||||
|
)]
|
||||||
pub async fn send(&self, command: OverwatchCommand) {
|
pub async fn send(&self, command: OverwatchCommand) {
|
||||||
if let Err(e) = self.sender.send(command).await {
|
if let Err(e) = self.sender.send(command).await {
|
||||||
error!(error=?e, "Error sending overwatch command");
|
error!(error=?e, "Error sending overwatch command");
|
||||||
|
|
|
@ -15,7 +15,9 @@ use tokio::runtime::{Handle, Runtime};
|
||||||
use tokio::sync::mpsc::Receiver;
|
use tokio::sync::mpsc::Receiver;
|
||||||
use tokio::sync::oneshot;
|
use tokio::sync::oneshot;
|
||||||
use tokio::task::JoinHandle;
|
use tokio::task::JoinHandle;
|
||||||
use tracing::{error, info, instrument};
|
use tracing::{error, info};
|
||||||
|
#[cfg(feature = "instrumentation")]
|
||||||
|
use tracing::instrument;
|
||||||
|
|
||||||
// internal
|
// internal
|
||||||
use crate::overwatch::commands::{
|
use crate::overwatch::commands::{
|
||||||
|
@ -142,7 +144,10 @@ where
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg_attr(feature = "instrumentation", instrument(name = "overwatch-run", skip_all))]
|
#[cfg_attr(
|
||||||
|
feature = "instrumentation",
|
||||||
|
instrument(name = "overwatch-run", skip_all)
|
||||||
|
)]
|
||||||
async fn run_(self, mut receiver: Receiver<OverwatchCommand>) {
|
async fn run_(self, mut receiver: Receiver<OverwatchCommand>) {
|
||||||
let Self {
|
let Self {
|
||||||
mut services,
|
mut services,
|
||||||
|
|
|
@ -10,7 +10,9 @@ use thiserror::Error;
|
||||||
use tokio::sync::mpsc::{channel, Receiver, Sender};
|
use tokio::sync::mpsc::{channel, Receiver, Sender};
|
||||||
use tokio::sync::oneshot;
|
use tokio::sync::oneshot;
|
||||||
use tokio_util::sync::PollSender;
|
use tokio_util::sync::PollSender;
|
||||||
use tracing::{error, instrument};
|
use tracing::error;
|
||||||
|
#[cfg(feature = "instrumentation")]
|
||||||
|
use tracing::instrument;
|
||||||
// internal
|
// internal
|
||||||
use crate::overwatch::commands::{OverwatchCommand, RelayCommand, ReplyChannel};
|
use crate::overwatch::commands::{OverwatchCommand, RelayCommand, ReplyChannel};
|
||||||
use crate::overwatch::handle::OverwatchHandle;
|
use crate::overwatch::handle::OverwatchHandle;
|
||||||
|
@ -179,7 +181,8 @@ impl<S: ServiceData> Relay<S> {
|
||||||
self.overwatch_handle.send(relay_command).await;
|
self.overwatch_handle.send(relay_command).await;
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg_attr(feature = "instrumentation", instrument(skip_all, err(Debug)))]
|
#[cfg_attr(feature = "instrumentation", instrument(skip_all, err(Debug)))
|
||||||
|
]
|
||||||
async fn handle_relay_response(
|
async fn handle_relay_response(
|
||||||
&self,
|
&self,
|
||||||
receiver: oneshot::Receiver<RelayResult>,
|
receiver: oneshot::Receiver<RelayResult>,
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
//std
|
//std
|
||||||
//crates
|
//crates
|
||||||
use tokio::sync::watch::{channel, Receiver, Sender};
|
use tokio::sync::watch::{channel, Receiver, Sender};
|
||||||
use tracing::{error, instrument};
|
use tracing::error;
|
||||||
|
#[cfg(feature = "instrumentation")]
|
||||||
|
use tracing::instrument;
|
||||||
//internal
|
//internal
|
||||||
|
|
||||||
/// Wrapper around [`tokio::sync::watch::Receiver`]
|
/// Wrapper around [`tokio::sync::watch::Receiver`]
|
||||||
|
|
Loading…
Reference in New Issue