Skip to content

Commit 8a80b28

Browse files
apollo_proc_macros: re-export metrics crate for downstream usage (#13849)
1 parent 21861c4 commit 8a80b28

6 files changed

Lines changed: 7 additions & 15 deletions

File tree

Cargo.lock

Lines changed: 1 addition & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/apollo_central_sync/Cargo.toml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ futures.workspace = true
2424
futures-util.workspace = true
2525
indexmap = { workspace = true, features = ["serde"] }
2626
lru.workspace = true
27-
metrics.workspace = true
2827
papyrus_base_layer.workspace = true
2928
papyrus_common.workspace = true
3029
reqwest = { workspace = true, features = ["blocking", "json"] }
@@ -42,13 +41,9 @@ assert_matches.workspace = true
4241
mockall.workspace = true
4342
pretty_assertions.workspace = true
4443
simple_logger.workspace = true
45-
starknet_api = { workspace = true, features = ["testing"] }
4644
starknet-types-core.workspace = true
45+
starknet_api = { workspace = true, features = ["testing"] }
4746
tokio-stream.workspace = true
4847

49-
[package.metadata.cargo-machete]
50-
# `metrics` is used in `latency_histogram` but is falsely detected as unused.
51-
ignored = ["metrics"]
52-
5348
[lints]
5449
workspace = true

crates/apollo_p2p_sync/Cargo.toml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ description = "Peer-to-peer state synchronization for Starknet nodes."
88

99
[dependencies]
1010
apollo_class_manager_types.workspace = true
11-
apollo_p2p_sync_config.workspace = true
1211
apollo_network.workspace = true
12+
apollo_p2p_sync_config.workspace = true
1313
apollo_proc_macros.workspace = true
1414
apollo_protobuf.workspace = true
1515
apollo_state_sync_metrics.workspace = true
@@ -23,7 +23,6 @@ enum-iterator.workspace = true
2323
futures.workspace = true
2424
indexmap.workspace = true
2525
lazy_static.workspace = true
26-
metrics.workspace = true
2726
papyrus_common.workspace = true
2827
rand.workspace = true
2928
rand_chacha.workspace = true
@@ -45,9 +44,5 @@ mockall.workspace = true
4544
static_assertions.workspace = true
4645
tokio = { workspace = true, features = ["test-util"] }
4746

48-
# The `metrics` crate is used by `latency_histogram` proc macro, which is used in this crate.
49-
[package.metadata.cargo-machete]
50-
ignored = ["metrics"]
51-
5247
[lints]
5348
workspace = true

crates/apollo_proc_macros/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ description = "Wrapper crate for the apollo_proc_macros_lib"
88

99
[dependencies]
1010
apollo_proc_macros_lib.workspace = true
11+
metrics.workspace = true
1112

1213
[lints]
1314
workspace = true

crates/apollo_proc_macros/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,5 @@ use std::sync::OnceLock;
66
pub static COLLECT_PROFILING_METRICS: OnceLock<bool> = OnceLock::new();
77

88
pub use apollo_proc_macros_lib::*;
9+
// Re-export for use in downstream crates.
10+
pub use metrics;

crates/apollo_proc_macros_lib/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ pub fn latency_histogram(attr: TokenStream, input: TokenStream) -> TokenStream {
168168
// instead of boolean
169169

170170
let metric_recording_logic = quote! {
171-
::metrics::histogram!(#metric_name).record(exec_time);
171+
apollo_proc_macros::metrics::histogram!(#metric_name).record(exec_time);
172172
};
173173

174174
let collect_metric_flag = quote! {

0 commit comments

Comments
 (0)