aboutsummaryrefslogtreecommitdiff
path: root/src/api/api_server.rs
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2022-02-18 20:39:55 +0100
committerAlex Auvolat <alex@adnab.me>2022-03-14 10:52:30 +0100
commitbb04d94fa92740eebeee513030faf136bfd26da7 (patch)
tree5e353982171819f00f03211855baef078156964b /src/api/api_server.rs
parent8c2fb0c066af7f68fdcfcdec96fa030af059bf63 (diff)
downloadgarage-bb04d94fa92740eebeee513030faf136bfd26da7.tar.gz
garage-bb04d94fa92740eebeee513030faf136bfd26da7.zip
Update to Netapp 0.4 which supports distributed tracing
Diffstat (limited to 'src/api/api_server.rs')
-rw-r--r--src/api/api_server.rs10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/api/api_server.rs b/src/api/api_server.rs
index 15b00dde..00d582d1 100644
--- a/src/api/api_server.rs
+++ b/src/api/api_server.rs
@@ -9,7 +9,7 @@ use hyper::{Body, Method, Request, Response, Server};
use opentelemetry::{
trace::{FutureExt, TraceContextExt, Tracer},
- Context,
+ Context, KeyValue,
};
use garage_util::data::*;
@@ -50,15 +50,19 @@ pub async fn run_api_server(
let garage = garage.clone();
let tracer = opentelemetry::global::tracer("garage");
- let uuid = gen_uuid();
+ let trace_id = gen_uuid();
let span = tracer
.span_builder("S3 API call (unknown)")
.with_trace_id(
opentelemetry::trace::TraceId::from_hex(&hex::encode(
- &uuid.as_slice()[..16],
+ &trace_id.as_slice()[..16],
))
.unwrap(),
)
+ .with_attributes(vec![
+ KeyValue::new("method", format!("{}", req.method())),
+ KeyValue::new("uri", req.uri().path().to_string()),
+ ])
.start(&tracer);
handler(garage, req, client_addr).with_context(Context::current_with_span(span))