Skip to content

Commit

Permalink
Move from github link to crates.io reference for minstant now that it…
Browse files Browse the repository at this point in the history
… exists. (#21)
  • Loading branch information
Stephen Cirner authored Jan 6, 2022
1 parent 577a1da commit 212673a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 18 deletions.
18 changes: 4 additions & 14 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ reqwest = { version = "0.11" }
minitrace = { git = "https://github.com/tikv/minitrace-rust.git" }
minitrace-macro = { git = "https://github.com/tikv/minitrace-rust.git" }
minitrace-datadog = { git = "https://github.com/tikv/minitrace-rust.git" }
minstant = { git = "https://github.com/tikv/minstant.git" }
minstant = "0.1.1"
# TODO can we upgrade this?
tokio = { version = "1.0", features = ["macros", "rt-multi-thread", "sync"] }
tokio-stream = "0.1"
Expand Down
5 changes: 2 additions & 3 deletions src/middleware/logging_grpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,9 @@ where
.unwrap_or(&default_trace_id)
.to_str()
.unwrap();
let start = minstant::now();
let start = minstant::Instant::now();
let response = inner.call(req).await?;
let end = minstant::now();
let elapsed_seconds = (end - start) as f64 * minstant::nanos_per_cycle() / 1_000_000_000f64;
let elapsed_seconds = start.elapsed().as_secs_f64();

if elapsed_seconds > upper_logging_bounds {
log::warn!("Trace ID: {} took {} second(s)", trace_id, elapsed_seconds);
Expand Down

0 comments on commit 212673a

Please sign in to comment.