Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: refine cargo features and deps, rename feature mtrace to tracing #754

Merged
merged 1 commit into from
Oct 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ jobs:
run: |
cargo clippy --all-targets --features tokio-console -- -D warnings
cargo clippy --all-targets --features deadlock -- -D warnings
cargo clippy --all-targets --features mtrace -- -D warnings
cargo clippy --all-targets --features tracing -- -D warnings
cargo clippy --all-targets -- -D warnings
- if: steps.cache.outputs.cache-hit != 'true'
uses: taiki-e/install-action@cargo-llvm-cov
Expand All @@ -191,8 +191,8 @@ jobs:
cargo llvm-cov --no-report run --example hybrid
cargo llvm-cov --no-report run --example hybrid_full
cargo llvm-cov --no-report run --example event_listener
cargo llvm-cov --no-report run --features "mtrace,jaeger" --example tail_based_tracing
cargo llvm-cov --no-report run --features "mtrace,ot" --example tail_based_tracing
cargo llvm-cov --no-report run --features "tracing,jaeger" --example tail_based_tracing
cargo llvm-cov --no-report run --features "tracing,ot" --example tail_based_tracing
- name: Run foyer-bench with coverage
if: runner.os == 'Linux'
env:
Expand Down
4 changes: 4 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,16 @@ fastrace-jaeger = "0.7"
fastrace-opentelemetry = "0.7"
clap = { version = "4", features = ["derive"] }
bytesize = { package = "foyer-bytesize", version = "2" }
hashbrown = "0.15"
# foyer components
foyer-common = { version = "0.12.0-dev", path = "foyer-common" }
foyer-intrusive = { version = "0.12.0-dev", path = "foyer-intrusive" }
foyer-memory = { version = "0.12.0-dev", path = "foyer-memory" }
foyer-storage = { version = "0.12.0-dev", path = "foyer-storage" }
foyer = { version = "0.12.0-dev", path = "foyer" }

[workspace.lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(madsim)'] }

[profile.release]
debug = "full"
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ check-all:
cargo clippy --all-targets --features deadlock
cargo clippy --all-targets --features tokio-console
cargo clippy --all-targets --features sanity
cargo clippy --all-targets --features mtrace
cargo clippy --all-targets --features tracing
cargo clippy --all-targets

test:
Expand All @@ -42,8 +42,8 @@ example:
cargo run --example hybrid
cargo run --example hybrid_full
cargo run --example event_listener
cargo run --features "mtrace,jaeger" --example tail_based_tracing
cargo run --features "mtrace,ot" --example tail_based_tracing
cargo run --features "tracing,jaeger" --example tail_based_tracing
cargo run --features "tracing,ot" --example tail_based_tracing

full: check-all test-all example udeps

Expand Down
2 changes: 1 addition & 1 deletion examples/tail_based_tracing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ fn init_exporter() {
panic!("Either jaeger or opentelemetry feature must be enabled!");
}

/// NOTE: To run this example, please enable feature "mtrace" and either "jaeger" or "ot".
/// NOTE: To run this example, please enable feature "tracing" and either "jaeger" or "ot".
#[tokio::main]
async fn main() -> anyhow::Result<()> {
init_exporter();
Expand Down
8 changes: 4 additions & 4 deletions foyer-bench/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ tikv-jemallocator = { version = "0.6", optional = true }
[features]
default = ["jemalloc"]
deadlock = ["parking_lot/deadlock_detection", "foyer/deadlock"]
tokio-console = ["console-subscriber"]
tokio-console = ["dep:console-subscriber"]
strict_assertions = ["foyer/strict_assertions"]
sanity = ["foyer/sanity"]
jemalloc = ["tikv-jemallocator"]
jeprof = ["jemalloc", "tikv-jemallocator/profiling"]
mtrace = ["foyer/mtrace", "fastrace-jaeger", "fastrace"]
jemalloc = ["dep:tikv-jemallocator"]
jeprof = ["jemalloc", "tikv-jemallocator?/profiling"]
tracing = ["foyer/tracing", "dep:fastrace-jaeger", "dep:fastrace"]
20 changes: 10 additions & 10 deletions foyer-bench/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -244,19 +244,19 @@ pub struct Args {
#[arg(long, default_value_t = 64)]
set_cache_capacity: usize,

/// Record insert trace threshold. Only effective with "mtrace" feature.
/// Record insert trace threshold. Only effective with "tracing" feature.
#[arg(long, default_value_t = 1000 * 1000)]
trace_insert_us: usize,
/// Record get trace threshold. Only effective with "mtrace" feature.
/// Record get trace threshold. Only effective with "tracing" feature.
#[arg(long, default_value_t = 1000 * 1000)]
trace_get_us: usize,
/// Record obtain trace threshold. Only effective with "mtrace" feature.
/// Record obtain trace threshold. Only effective with "tracing" feature.
#[arg(long, default_value_t = 1000 * 1000)]
trace_obtain_us: usize,
/// Record remove trace threshold. Only effective with "mtrace" feature.
/// Record remove trace threshold. Only effective with "tracing" feature.
#[arg(long, default_value_t = 1000 * 1000)]
trace_remove_us: usize,
/// Record fetch trace threshold. Only effective with "mtrace" feature.
/// Record fetch trace threshold. Only effective with "tracing" feature.
#[arg(long, default_value_t = 1000 * 1000)]
trace_fetch_us: usize,
}
Expand Down Expand Up @@ -350,14 +350,14 @@ fn setup() {
console_subscriber::init();
}

#[cfg(feature = "mtrace")]
#[cfg(feature = "tracing")]
fn setup() {
use fastrace::collector::Config;
let reporter = fastrace_jaeger::JaegerReporter::new("127.0.0.1:6831".parse().unwrap(), "foyer-bench").unwrap();
fastrace::set_reporter(reporter, Config::default().report_interval(Duration::from_millis(1)));
}

#[cfg(not(any(feature = "tokio-console", feature = "mtrace")))]
#[cfg(not(any(feature = "tokio-console", feature = "tracing")))]
fn setup() {
use tracing_subscriber::{prelude::*, EnvFilter};

Expand All @@ -371,10 +371,10 @@ fn setup() {
.init();
}

#[cfg(not(any(feature = "mtrace")))]
#[cfg(not(any(feature = "tracing")))]
fn teardown() {}

#[cfg(feature = "mtrace")]
#[cfg(feature = "tracing")]
fn teardown() {
fastrace::flush();
}
Expand Down Expand Up @@ -532,7 +532,7 @@ async fn benchmark(args: Args) {
.await
.unwrap();

#[cfg(feature = "mtrace")]
#[cfg(feature = "tracing")]
hybrid.enable_tracing();

let stats = hybrid.stats();
Expand Down
8 changes: 4 additions & 4 deletions foyer-common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ cfg-if = "1"
crossbeam = "0.8"
fastrace = { workspace = true }
futures = "0.3"
hashbrown = "0.14"
hashbrown = { workspace = true }
itertools = { workspace = true }
metrics = { workspace = true }
parking_lot = { version = "0.12", features = ["arc_lock"] }
Expand All @@ -32,7 +32,7 @@ rand = "0.8.5"

[features]
strict_assertions = []
mtrace = ["fastrace/enable"]
tracing = ["fastrace/enable"]

[lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(madsim)'] }
[lints]
workspace = true
4 changes: 2 additions & 2 deletions foyer-memory/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ fastrace = { workspace = true }
foyer-common = { workspace = true }
foyer-intrusive = { workspace = true }
futures = "0.3"
hashbrown = "0.14"
hashbrown = { workspace = true }
itertools = { workspace = true }
parking_lot = "0.12"
pin-project = "1"
Expand All @@ -43,7 +43,7 @@ strict_assertions = [
"foyer-intrusive/strict_assertions",
]
sanity = ["strict_assertions"]
mtrace = ["fastrace/enable", "foyer-common/mtrace"]
tracing = ["fastrace/enable", "foyer-common/tracing"]

[[bench]]
name = "bench_hit_ratio"
Expand Down
7 changes: 4 additions & 3 deletions foyer-storage/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ foyer-common = { workspace = true }
foyer-memory = { workspace = true }
fs4 = "0.9.1"
futures = "0.3"
hashbrown = { workspace = true }
itertools = { workspace = true }
libc = "0.2"
lz4 = "1.24"
Expand Down Expand Up @@ -60,7 +61,7 @@ strict_assertions = [
"foyer-common/strict_assertions",
"foyer-memory/strict_assertions",
]
mtrace = ["fastrace/enable", "foyer-common/mtrace", "foyer-memory/mtrace"]
tracing = ["fastrace/enable", "foyer-common/tracing", "foyer-memory/tracing"]

[lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(madsim)'] }
[lints]
workspace = true
2 changes: 1 addition & 1 deletion foyer-util/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ bytes = "1"
cfg-if = "1"
foyer-common = { workspace = true }
futures = "0.3"
hashbrown = "0.14"
hashbrown = { workspace = true }
itertools = { workspace = true }
parking_lot = { version = "0.12", features = ["arc_lock"] }
serde = { workspace = true }
Expand Down
8 changes: 4 additions & 4 deletions foyer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ strict_assertions = [
"foyer-storage/strict_assertions",
]
sanity = ["strict_assertions", "foyer-memory/sanity"]
mtrace = [
tracing = [
"fastrace/enable",
"foyer-common/mtrace",
"foyer-memory/mtrace",
"foyer-storage/mtrace",
"foyer-common/tracing",
"foyer-memory/tracing",
"foyer-storage/tracing",
]
Loading