Skip to content

Commit 868ac53

Browse files
authored
[ENH] Add user agent to rust frontend traces (#4323)
## Description of changes Adds user agent to rust frontend traces. Previously this was included in the legacy frontend traces, but we had not included it in the rust frontend traces (yet). ## Test plan Tested locally with tilt environment, confirmed traces included user agent in jaeger. ## Documentation Changes n/a
1 parent 6f4fbb3 commit 868ac53

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Diff for: rust/frontend/src/tower_tracing.rs

+6
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@ impl<B> MakeSpan<B> for RequestTracing {
2424
.get(header::HOST)
2525
.map_or("", |h| h.to_str().unwrap_or(""));
2626

27+
let user_agent = request
28+
.headers()
29+
.get(header::USER_AGENT)
30+
.map_or("", |h| h.to_str().unwrap_or(""));
31+
2732
let name = format!("{} {}", request.method(), http_route);
2833

2934
tracing::span!(
@@ -35,6 +40,7 @@ impl<B> MakeSpan<B> for RequestTracing {
3540
http.version = ?request.version(),
3641
http.host = %host,
3742
http.status_code = tracing::field::Empty,
43+
http.user_agent = %user_agent,
3844
otel.name = name,
3945
otel.status_code = tracing::field::Empty,
4046
)

0 commit comments

Comments
 (0)