Skip to content

Commit

Permalink
Fix build when telemetry is disabled (#2583)
Browse files Browse the repository at this point in the history
  • Loading branch information
romac authored Aug 22, 2022
1 parent 949144e commit ed4dd8c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
4 changes: 2 additions & 2 deletions relayer/src/chain/cosmos/retry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,13 @@ pub async fn send_tx_with_account_sequence_retry(
let _span =
span!(Level::ERROR, "send_tx_with_account_sequence_retry", id = %config.chain_id).entered();

let number_messages = messages.len() as u64;
let _number_messages = messages.len() as u64;

match do_send_tx_with_account_sequence_retry(config, key_entry, account, tx_memo, messages)
.await
{
Ok(res) => {
telemetry!(total_messages_submitted, &config.chain_id, number_messages);
telemetry!(total_messages_submitted, &config.chain_id, _number_messages);
Ok(res)
}
Err(e) => Err(e),
Expand Down
2 changes: 1 addition & 1 deletion relayer/src/supervisor/scan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ use ibc::core::{
},
ics24_host::identifier::{ChainId, ChannelId, ClientId, ConnectionId, PortId},
};
use ibc_telemetry::state::WorkerType;

use crate::{
chain::{
Expand Down Expand Up @@ -859,6 +858,7 @@ fn query_connection_channels<Chain: ChainHandle>(
/// For example if the client workers or client misbehaviour detection have
/// been disabled in the configuration, the `client_misbehaviours_submitted`
/// will never record any value as no misbehaviour will be submitted.
#[allow(unused_variables)]
fn init_telemetry(
chain_id: &ChainId,
client: &ClientId,
Expand Down
11 changes: 6 additions & 5 deletions relayer/src/telemetry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,20 @@ pub type Telemetry = TelemetryDisabled;
macro_rules! telemetry {
($id:ident, $($args:expr),* $(,)*) => {
#[cfg(feature = "telemetry")]
#[allow(unused_imports, unused_variables)]
{
::ibc_telemetry::global().$id($($args),*);
}
use ::ibc_telemetry::state::WorkerType;

#[cfg(not(feature = "telemetry"))]
{
let _ = ($($args),*);
::ibc_telemetry::global().$id($($args),*);
}
};

($e:expr) => {
#[cfg(feature = "telemetry")]
#[allow(unused_imports, unused_variables)]
{
use ::ibc_telemetry::state::WorkerType;

$e;
}
};
Expand Down

0 comments on commit ed4dd8c

Please # to comment.