Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include pod UID and container name as optional trace labels #3483

Merged
merged 1 commit into from
Jan 30, 2025

Conversation

sfleen
Copy link
Collaborator

@sfleen sfleen commented Dec 20, 2024

It's useful to include these fields in the trace span attributes to help correlate traffic within a cluster.

This propagates these labels through the trace initialization, similar to how we handle the service name (and other labels that last for the entire pod lifetime).

See linkerd/linkerd2#13501 for the corresponding control plane change.

@sfleen sfleen requested a review from a team as a code owner December 20, 2024 16:45
@cratelyn
Copy link
Collaborator

you've been clippy'ed 📎 🙀

Error: error: this function has too many arguments (8/7)
  --> linkerd/app/src/trace_collector/otel_collector.rs:21:1
   |
21 | / pub(super) fn create_collector<S>(
22 | |     addr: ControlAddr,
23 | |     hostname: Option<String>,
24 | |     pod_uid: Option<String>,
...  |
29 | |     legacy_metrics: metrics::Registry,
30 | | ) -> EnabledCollector
   | |_____________________^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#too_many_arguments
   = note: `-D clippy::too-many-arguments` implied by `-D warnings`
   = help: to override `-D warnings` add `#[allow(clippy::too_many_arguments)]`

Copy link
Collaborator

@cratelyn cratelyn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

besides the note about clippy lints above, this looks like a good PR to me. this should be a nice improvement to our traces!

linkerd/app/src/env.rs Outdated Show resolved Hide resolved
Copy link

codecov bot commented Dec 20, 2024

Codecov Report

Attention: Patch coverage is 5.00000% with 19 lines in your changes missing coverage. Please review.

Project coverage is 66.59%. Comparing base (96124bc) to head (2a8c4e4).
Report is 768 commits behind head on main.

Files with missing lines Patch % Lines
linkerd/app/src/trace_collector/otel_collector.rs 0.00% 7 Missing ⚠️
linkerd/app/src/trace_collector.rs 0.00% 6 Missing ⚠️
linkerd/app/src/env.rs 20.00% 4 Missing ⚠️
linkerd/app/src/env/trace.rs 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3483      +/-   ##
==========================================
- Coverage   67.68%   66.59%   -1.09%     
==========================================
  Files         332      390      +58     
  Lines       15158    18340    +3182     
==========================================
+ Hits        10259    12214    +1955     
- Misses       4899     6126    +1227     
Files with missing lines Coverage Δ
linkerd/app/src/env/trace.rs 46.66% <0.00%> (ø)
linkerd/app/src/env.rs 52.73% <20.00%> (-6.67%) ⬇️
linkerd/app/src/trace_collector.rs 26.47% <0.00%> (ø)
linkerd/app/src/trace_collector/otel_collector.rs 0.00% <0.00%> (ø)

... and 172 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2062f0c...2a8c4e4. Read the comment docs.

@sfleen sfleen force-pushed the otel-pod-id branch 2 times, most recently from d76fa98 to 89d0203 Compare January 6, 2025 13:46
linkerd/app/src/env.rs Outdated Show resolved Hide resolved
This allows us to include arbitrary values from the k8s downward API beyond just the pod labels that are included in the trace attributes file.

See linkerd/linkerd2#13544 for the corresponding control plane change.

Signed-off-by: Scott Fleener <[email protected]>
@sfleen sfleen merged commit 00cba97 into linkerd:main Jan 30, 2025
16 of 17 checks passed
@sfleen sfleen deleted the otel-pod-id branch January 31, 2025 15:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants