Skip to content

Commit

Permalink
Merge pull request #908 from drmingdrmer/44-tracing-log-option
Browse files Browse the repository at this point in the history
Feature: add feature flag "tracing-log" to emit log record for tracing event
  • Loading branch information
drmingdrmer authored Aug 2, 2023
2 parents 6ada312 + 3fc8ede commit 4b78dd3
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ serde_json = "1.0.57"
tempfile = { version = "3.4.0" }
thiserror = "1.0.33"
tokio = { version="1.8", default-features=false, features=["fs", "io-util", "macros", "rt", "rt-multi-thread", "sync", "time"] }
tracing = "0.1.29"
tracing = { version = "0.1.29" }
tracing-appender = "0.2.0"
tracing-futures = "0.2.4"
tracing-subscriber = { version = "0.3.3", features=["env-filter"] }
Expand Down
5 changes: 5 additions & 0 deletions openraft/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,11 @@ singlethreaded = ["macros/singlethreaded"]
# For instance, in an even number nodes cluster, erasing a node's data and then rebooting it(log reverts to empty) will not result in data loss.
loosen-follower-log-revert = []

# Enables "log" feature in `tracing` crate, to let tracing events emit log
# record.
# See: https://docs.rs/tracing/latest/tracing/#emitting-log-records
tracing-log = [ "tracing/log" ]

# default = ["single-term-leader"]

[package.metadata.docs.rs]
Expand Down
6 changes: 5 additions & 1 deletion openraft/src/docs/feature_flags/feature-flags.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,13 @@ By default openraft enables no features.
This feature disables `Adapter`, which is for v1 storage to be used as v2.
V2 storage separates log store and state machine store so that log IO and state machine IO can be parallelized naturally.
<br/><br/>

- `singlethreaded`: removes `Send` bounds from `AppData`, `AppDataResponse`, `RaftEntry`, and `SnapshotData` to force the
asynchronous runtime to spawn any tasks in the current thread.
This is for any single-threaded application that never allows a raft instance to be shared among multiple threads.
In order to use the feature, `AsyncRuntime::spawn` should invoke `tokio::task::spawn_local` or equivalents.
<br/><br/>

- `tracing-log`: enables "log" feature in `tracing` crate, to let tracing events
emit log record.
See: [tracing doc: emitting-log-records](https://docs.rs/tracing/latest/tracing/#emitting-log-records)

0 comments on commit 4b78dd3

Please sign in to comment.