aboutsummaryrefslogtreecommitdiff
path: root/src/util
diff options
context:
space:
mode:
Diffstat (limited to 'src/util')
-rw-r--r--src/util/metrics.rs9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/util/metrics.rs b/src/util/metrics.rs
index cd5aa182..1b05eabe 100644
--- a/src/util/metrics.rs
+++ b/src/util/metrics.rs
@@ -1,8 +1,9 @@
use std::time::SystemTime;
use futures::{future::BoxFuture, Future, FutureExt};
+use rand::Rng;
-use opentelemetry::{metrics::*, KeyValue};
+use opentelemetry::{metrics::*, trace::TraceId, KeyValue};
pub trait RecordDuration<'a>: 'a {
type Output;
@@ -48,3 +49,9 @@ where
.boxed()
}
}
+
+// ----
+
+pub fn gen_trace_id() -> TraceId {
+ rand::thread_rng().gen::<[u8; 16]>().into()
+}