Skip to content

Commit 21861c4

Browse files
apollo_proc_macros: move COLLECT_PROFILING_METRICS out of papyrus_common (#13848)
1 parent e50ae85 commit 21861c4

7 files changed

Lines changed: 15 additions & 18 deletions

File tree

Cargo.lock

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,8 @@
1+
use std::sync::OnceLock;
2+
3+
// TODO(Shahak): consider making this value non static and add a way to change this while the app is
4+
// running. e.g via a monitoring endpoint.
5+
/// Global variable set by the main config to enable collecting profiling metrics.
6+
pub static COLLECT_PROFILING_METRICS: OnceLock<bool> = OnceLock::new();
7+
18
pub use apollo_proc_macros_lib::*;

crates/apollo_proc_macros_lib/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ pub fn latency_histogram(attr: TokenStream, input: TokenStream) -> TokenStream {
172172
};
173173

174174
let collect_metric_flag = quote! {
175-
papyrus_common::metrics::COLLECT_PROFILING_METRICS
175+
apollo_proc_macros::COLLECT_PROFILING_METRICS
176176
};
177177

178178
create_modified_function(

crates/apollo_proc_macros_tests/tests/latency_histogram.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,14 @@ use apollo_metrics::metrics::{
66
MetricScope,
77
COLLECT_SEQUENCER_PROFILING_METRICS,
88
};
9-
use apollo_proc_macros::{latency_histogram, sequencer_latency_histogram};
9+
use apollo_proc_macros::{
10+
latency_histogram,
11+
sequencer_latency_histogram,
12+
COLLECT_PROFILING_METRICS,
13+
};
1014
use apollo_test_utils::prometheus_is_contained;
1115
use metrics::set_default_local_recorder;
1216
use metrics_exporter_prometheus::PrometheusBuilder;
13-
use papyrus_common::metrics::COLLECT_PROFILING_METRICS;
1417
use prometheus_parse::Value::Untyped;
1518
use rstest::rstest;
1619

crates/apollo_storage/Cargo.toml

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ license-file.workspace = true
77
description = "A storage implementation for a Starknet node."
88

99
[features]
10-
testing = ["reqwest", "starknet_api/testing", "tempfile", "tower"]
1110
storage_cli = ["clap", "reqwest"]
11+
testing = ["reqwest", "starknet_api/testing", "tempfile", "tower"]
1212

1313
[dependencies]
1414
apollo_config.workspace = true
@@ -31,14 +31,13 @@ memmap2.workspace = true
3131
metrics.workspace = true
3232
num-bigint.workspace = true
3333
page_size.workspace = true
34-
papyrus_common.workspace = true
3534
parity-scale-codec.workspace = true
3635
primitive-types.workspace = true
3736
reqwest = { workspace = true, features = ["json"], optional = true }
3837
serde = { workspace = true, features = ["derive"] }
3938
serde_json = { workspace = true, features = ["arbitrary_precision"] }
40-
starknet_api.workspace = true
4139
starknet-types-core = { workspace = true, features = ["papyrus-serialization"] }
40+
starknet_api.workspace = true
4241
tempfile = { workspace = true, optional = true }
4342
thiserror.workspace = true
4443
tokio = { workspace = true, features = ["rt-multi-thread"] }
@@ -77,10 +76,6 @@ tower = { workspace = true, features = ["util"] }
7776
[lints]
7877
workspace = true
7978

80-
# Used in apollo_proc_macros for latency_histogram.
81-
[package.metadata.cargo-machete]
82-
ignored = ["papyrus_common"]
83-
8479

8580
[[bin]]
8681
name = "storage_cli"

crates/papyrus_common/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
pub mod deprecated_class_abi;
2-
pub mod metrics;
32
pub mod pending_classes;
43
pub mod python_json;
54
pub mod state;

crates/papyrus_common/src/metrics.rs

Lines changed: 0 additions & 6 deletions
This file was deleted.

0 commit comments

Comments
 (0)