From a7abadb80dadf23cfd604b2f05403204f72665f5 Mon Sep 17 00:00:00 2001 From: 0x009922 <43530070+0x009922@users.noreply.github.com> Date: Wed, 9 Oct 2024 12:38:05 +0900 Subject: [PATCH] fix: comment out more `metric-instrumentation` code Signed-off-by: 0x009922 <43530070+0x009922@users.noreply.github.com> --- crates/iroha_telemetry_derive/src/lib.rs | 56 ++++++++++++------------ 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/crates/iroha_telemetry_derive/src/lib.rs b/crates/iroha_telemetry_derive/src/lib.rs index d982766f733..d5febea0894 100644 --- a/crates/iroha_telemetry_derive/src/lib.rs +++ b/crates/iroha_telemetry_derive/src/lib.rs @@ -244,26 +244,26 @@ fn impl_metrics( } }; - #[cfg(feature = "metric-instrumentation")] - { - let (totals, successes, times) = write_metrics(metric_arg_ident, specs); - return quote!( - #(#attrs)* #vis #sig { - let _closure = || #block; - let started_at = std::time::Instant::now(); - - #totals - let res = _closure(); - - #times - if let Ok(_) = res { - #successes - }; - res - }); - }; + // #[cfg(feature = "metric-instrumentation")] + // { + // let (totals, successes, times) = write_metrics(metric_arg_ident, specs); + // quote!( + // #(#attrs)* #vis #sig { + // let closure = || #block; + // let started_at = std::time::Instant::now(); + // + // #totals + // let res = closure(); + // + // #times + // if let Ok(_) = res { + // #successes + // }; + // res + // }) + // } - #[cfg(not(feature = "metric-instrumentation"))] + // #[cfg(not(feature = "metric-instrumentation"))] quote!( #(#attrs)* #vis #sig { #block @@ -279,19 +279,19 @@ fn write_metrics( ) -> (TokenStream, TokenStream, TokenStream) { let inc_metric = |spec: &MetricSpec, kind: &str| { quote!( - // #metric_arg_ident - // .metrics - // .isi - // .with_label_values( &[#spec, #kind ]).inc(); + #metric_arg_ident + .metrics + .isi + .with_label_values( &[#spec, #kind ]).inc(); ) }; let track_time = |spec: &MetricSpec| { quote!( - // #metric_arg_ident - // .metrics - // .isi_times - // .with_label_values( &[#spec]) - // .observe(started_at.elapsed().as_millis() as f64); + #metric_arg_ident + .metrics + .isi_times + .with_label_values( &[#spec]) + .observe(started_at.elapsed().as_millis() as f64); ) }; let totals: TokenStream = specs