diff options
author | Alex Auvolat <alex@adnab.me> | 2022-02-22 15:21:06 +0100 |
---|---|---|
committer | Alex Auvolat <alex@adnab.me> | 2022-03-14 10:53:50 +0100 |
commit | d9a35359bf8903f37f5f7aa77421ed35b626e0af (patch) | |
tree | 1b781e5e6de4d850e4938d6192f15c628e2eed27 /src/util | |
parent | 2a5609b292de019085f93a79b7b73f7a8341bf51 (diff) | |
download | garage-d9a35359bf8903f37f5f7aa77421ed35b626e0af.tar.gz garage-d9a35359bf8903f37f5f7aa77421ed35b626e0af.zip |
Add metrics to web endpoint
Diffstat (limited to 'src/util')
-rw-r--r-- | src/util/metrics.rs | 9 |
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() +} |