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

OTEL: adding flags to cli traces #10974

Merged
merged 5 commits into from Sep 7, 2023
Merged

Conversation

rvigus
Copy link
Contributor

@rvigus rvigus commented Sep 5, 2023

What I did
Adds cli args and flags (e.g. --timeout, --dry-run, etc) as attributes to cli trace data. These attributes are then picked up by the collector and made available to the end user.

Related issue
https://docker.atlassian.net/browse/ENV-276

@codecov
Copy link

codecov bot commented Sep 5, 2023

Codecov Report

Patch coverage: 47.16% and project coverage change: -0.65% ⚠️

Comparison is base (aeb835a) 58.30% compared to head (757983c) 57.65%.
Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #10974      +/-   ##
==========================================
- Coverage   58.30%   57.65%   -0.65%     
==========================================
  Files         124      127       +3     
  Lines       10912    11046     +134     
==========================================
+ Hits         6362     6369       +7     
- Misses       3922     4044     +122     
- Partials      628      633       +5     
Files Changed Coverage Δ
pkg/api/api.go 28.84% <ø> (ø)
pkg/compose/publish.go 0.00% <0.00%> (ø)
pkg/remote/git.go 1.69% <0.00%> (-8.31%) ⬇️
pkg/remote/oci.go 2.46% <2.46%> (ø)
cmd/compose/events.go 28.20% <16.66%> (ø)
cmd/compose/kill.go 48.14% <25.00%> (ø)
cmd/compose/push.go 41.37% <25.00%> (ø)
cmd/compose/viz.go 51.02% <25.00%> (ø)
cmd/compose/watch.go 31.03% <25.00%> (ø)
cmd/compose/config.go 33.95% <28.57%> (-0.19%) ⬇️
... and 28 more

... and 3 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@rvigus rvigus changed the title OTEL: adding flags to cli traces WIP - OTEL: adding flags to cli traces Sep 6, 2023
@rvigus rvigus changed the title WIP - OTEL: adding flags to cli traces OTEL: adding flags to cli traces Sep 6, 2023
Copy link
Member

@milas milas left a comment

Choose a reason for hiding this comment

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

Nice! LGTM, just a pedantic naming style request that's not your fault since I never documented it anywhere 😛

Comment on lines 57 to 58
cmdSpan.SetAttributes(attribute.StringSlice("cliArgs", args))
cmdSpan.SetAttributes(attribute.StringSlice("cliFlags", getFlags(cmd.Flags())))
Copy link
Member

Choose a reason for hiding this comment

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

Since span attributes are a single-level map, so far I've been separating logical groups with ., e.g. cli.args / cli.flags.

(I'm realizing I should add a TRACING.md to the repo here with some info...serious 🚌 factor right now)

@milas
Copy link
Member

milas commented Sep 6, 2023

Ah, for your failures:

  • The DCO failure has the explanation, but basically you have to git commit --amend -s to sign-off and then force-push your PR
  • You need to add the license to the top of the test file, you can copy+paste it from another. (There's also a way to configure GoLand to insert this automatically, but I always do it manually 🙈)
    • Run make validate-headers to ensure it's good
  • Can run lint locally with golangci-lint run if you have it installed or make lint to let it do it in a container

Signed-off-by: rvigus <roryvigus@gmail.com>
Signed-off-by: rvigus <roryvigus@gmail.com>
Signed-off-by: rvigus <roryvigus@gmail.com>
Signed-off-by: rvigus <roryvigus@gmail.com>
@rvigus rvigus marked this pull request as ready for review September 7, 2023 13:57
@rvigus rvigus requested a review from milas September 7, 2023 14:05
@milas milas merged commit e1aa4f7 into docker:main Sep 7, 2023
25 checks passed
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.

None yet

2 participants