Skip to content

Commit 453bbb9

Browse files
committed
fix: tracing timings
1 parent 60e9c86 commit 453bbb9

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

88
## [Unreleased]
9+
### Fix
10+
11+
- Fix tracing timings
912

1013
## [0.3.4]
1114

src/lib.rs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -462,11 +462,17 @@ impl Extension for ApolloTracingExtension {
462462
Err(e)
463463
}
464464
};
465-
let end_time = Utc::now();
465+
let end_time = Utc::now() - self.inner.lock().await.end_time;
466466

467-
node.write()
468-
.await
469-
.set_end_time(end_time.timestamp_nanos().try_into().unwrap());
467+
node.write().await.set_end_time(
468+
match end_time
469+
.num_nanoseconds()
470+
.and_then(|x| u64::try_from(x).ok())
471+
{
472+
Some(duration) => duration,
473+
None => Utc::now().timestamp_nanos().try_into().unwrap(),
474+
},
475+
);
470476

471477
match parent_node {
472478
None => {

0 commit comments

Comments
 (0)