mirror of
https://github.com/logos-co/Overwatch.git
synced 2025-02-26 13:15:29 +00:00
Feature gate instrument macro.
This commit is contained in:
parent
848e3635d7
commit
78dfd8999d
@ -21,6 +21,7 @@ exclude = [
|
||||
[features]
|
||||
default = ["derive"]
|
||||
derive = ["dep:overwatch-derive"]
|
||||
instrumentation = []
|
||||
|
||||
[dependencies]
|
||||
overwatch-derive = { path = "../overwatch-derive", optional = true }
|
||||
|
@ -62,14 +62,13 @@ impl OverwatchHandle {
|
||||
}
|
||||
|
||||
/// Send an overwatch command to the overwatch runner
|
||||
#[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) {
|
||||
if let Err(e) = self.sender.send(command).await {
|
||||
error!(error=?e, "Error sending overwatch command");
|
||||
}
|
||||
}
|
||||
|
||||
#[instrument(skip(self))]
|
||||
#[cfg_attr(feature = "instrumentation", instrument(skip(self)))]
|
||||
pub async fn update_settings<S: Services>(&self, settings: S::Settings)
|
||||
where
|
||||
S::Settings: Send,
|
||||
|
@ -142,7 +142,7 @@ where
|
||||
})
|
||||
}
|
||||
|
||||
#[instrument(name = "overwatch-run", skip_all)]
|
||||
#[cfg_attr(feature = "instrumentation", instrument(name = "overwatch-run", skip_all))]
|
||||
async fn run_(self, mut receiver: Receiver<OverwatchCommand>) {
|
||||
let Self {
|
||||
mut services,
|
||||
|
@ -164,7 +164,7 @@ impl<S: ServiceData> Relay<S> {
|
||||
}
|
||||
}
|
||||
|
||||
#[instrument(skip(self), err(Debug))]
|
||||
#[cfg_attr(feature = "instrumentation", instrument(skip(self), err(Debug)))]
|
||||
pub async fn connect(self) -> Result<OutboundRelay<S::Message>, RelayError> {
|
||||
let (reply, receiver) = oneshot::channel();
|
||||
self.request_relay(reply).await;
|
||||
@ -179,7 +179,7 @@ impl<S: ServiceData> Relay<S> {
|
||||
self.overwatch_handle.send(relay_command).await;
|
||||
}
|
||||
|
||||
#[instrument(skip_all, err(Debug))]
|
||||
#[cfg_attr(feature = "instrumentation", instrument(skip_all, err(Debug)))]
|
||||
async fn handle_relay_response(
|
||||
&self,
|
||||
receiver: oneshot::Receiver<RelayResult>,
|
||||
|
@ -41,7 +41,7 @@ impl<S> SettingsUpdater<S> {
|
||||
}
|
||||
|
||||
/// Send a new settings update notification to the watcher end
|
||||
#[instrument(skip_all)]
|
||||
#[cfg_attr(feature = "instrumentation", instrument(skip_all))]
|
||||
pub fn update(&self, settings: S) {
|
||||
self.sender.send(settings).unwrap_or_else(|_e| {
|
||||
error!("Error sending settings update for service");
|
||||
|
Loading…
x
Reference in New Issue
Block a user