Skip to content

Commit 076a029

Browse files
authored
Merge pull request #793 from Migorithm/feat/tracing-appender
feat: shared logging
2 parents 73c74fc + 9669fea commit 076a029

9 files changed

Lines changed: 244 additions & 54 deletions

File tree

Cargo.lock

Lines changed: 147 additions & 20 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Makefile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,8 @@ cli:
3030

3131
cli-cluster:
3232
@echo '🚀 Starting client in local_test/cli...'
33-
cargo run -p duva-client -- --port $(p) --cluster-mode
33+
cargo run -p duva-client -- --port $(p) --cluster-mode
34+
35+
36+
sort_log:
37+
jq -c '.' duva/shared.log | sort -t'"' -k4,4 duva/shared.log > shared_log_sorted.json

duva-client/src/broker/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
mod node_connections;
22
mod read_stream;
33
mod write_stream;
4-
use std::collections::HashMap;
54

65
use crate::broker::node_connections::NodeConnections;
76
use crate::command::{CommandQueue, CommandToServer, InputContext, RoutingRule};

duva/Cargo.toml

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,26 +8,31 @@ edition = "2024"
88

99
# DON'T EDIT THIS!
1010
[dependencies]
11-
anyhow = "1.0.97" # error handling
12-
bytes = "1.10.1" # helps manage buffers
13-
thiserror = "2.0.12" # error handling
11+
anyhow = "1.0.97" # error handling
12+
bytes = "1.10.1" # helps manage buffers
13+
thiserror = "2.0.12" # error handling
1414
tokio = { version = "1.44.2", features = ["full"] }
15-
rand = { version = "0.9.0", features = ["std"] } # async networking
16-
futures = "0.3.31" # async networking
17-
memmap2 = "0.9.5" # memory mapping
15+
rand = { version = "0.9.0", features = ["std"] } # async networking
16+
futures = "0.3.31" # async networking
17+
memmap2 = "0.9.5" # memory mapping
1818
chrono = "0.4.40"
19-
bincode = { version = "2.0.1" } # serialization
20-
uuid = { version = "1.16.0", features = ["v7"] } # unique id generation
19+
bincode = { version = "2.0.1" } # serialization
20+
uuid = { version = "1.16.0", features = ["v7"] } # unique id generation
2121
memchr = "2.7.4"
2222
regex = "1.11.1"
2323
tracing = "0.1.41"
24-
tracing-subscriber = "0.3.19"
25-
async-trait = "0.1.88" # async trait support
24+
tracing-subscriber = { version = "0.3", features = [
25+
"env-filter",
26+
"json",
27+
"time",
28+
] }
29+
tracing-appender = "0.2.3"
30+
async-trait = "0.1.88" # async trait support
2631
lzf = { version = "1.0.0" }
2732

2833
[dev-dependencies]
2934
tempfile = "3.19.1"
30-
criterion = "0.6.0"
35+
criterion = "0.7.0"
3136

3237
[[bench]]
3338
name = "benchmark"

duva/src/config.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ pub struct Environment {
2222
pub ttl_mills: u128,
2323
pub append_only: bool,
2424
pub tpp: String,
25-
pub log_level: tracing::Level,
25+
pub log_level: tracing::level_filters::LevelFilter,
2626
}
2727

2828
impl Environment {
@@ -37,7 +37,7 @@ impl Environment {
3737
ttl: u128 = 60000,
3838
append_only: bool = false,
3939
tpp: String = "duva.tp".to_string(),
40-
log_level : tracing::Level = tracing::Level::INFO,
40+
log_level : tracing::level_filters::LevelFilter = tracing::level_filters::LevelFilter::INFO,
4141
},
4242
optional: {
4343
replicaof

duva/src/domains/cluster_actors/actor.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -981,7 +981,6 @@ impl<T: TWriteAheadLog> ClusterActor<T> {
981981
// * Raft followers should truncate their log starting at prev_log_index + 1 and then append the new entries
982982
// * Just returning an error is breaking consistency
983983
if let Some(prev_entry) = self.logger.read_at(prev_log_index) {
984-
debug!("Previous log entry: {:?}", prev_entry);
985984
if prev_entry.term != prev_log_term {
986985
// ! Term mismatch -> triggers log truncation
987986
err!("Term mismatch: {} != {}", prev_entry.term, prev_log_term);

0 commit comments

Comments
 (0)