cli icon indicating copy to clipboard operation
cli copied to clipboard

🚧 Initial otel implementation 🚧

Open krissetto opened this issue 1 year ago • 1 comments

- What's this?

This PR is based off of the shared otel code contained in #4889. It is mostly a test to see what parts can be common and shared across projects, and how to best setup these utilities.

The relevant changes can be found in the telemetry_utils.go and docker.go files, the rest can be ignored as it's already being discussed in the other PR.

- Goal

The very first goal is to provide enough metrics to cover the compose wrapper's current usage (so we can then remove it).
To keep continuity with the current impl in the compose wrapper, these should include at minimum:

  • command name;
  • command duration;
  • command status ("success"/"failure");
  • command exit code

Pls note that the organization of the code is not final and will surely be adjusted as the implementation matures

- What I did

  • Added some utils for otel related ops
  • Implemented an initial version of otel metrics using the utils ^

- How I did it

Taking inspiration and adapting bits from buildx and the compose wrapper

- How to verify it

Manually. Automated tests still need to be defined

- Description for the changelog

- A picture of a cute animal (not mandatory but encouraged)

krissetto avatar Mar 13 '24 14:03 krissetto

Codecov Report

Merging #4940 (3bc46b3) into master (b8d5454) will decrease coverage by 0.22%. The diff coverage is 10.86%.

:exclamation: Current head 3bc46b3 differs from pull request most recent head efd82e1. Consider uploading reports for the commit efd82e1 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4940      +/-   ##
==========================================
- Coverage   61.19%   60.97%   -0.22%     
==========================================
  Files         294      295       +1     
  Lines       20538    20625      +87     
==========================================
+ Hits        12568    12576       +8     
- Misses       7076     7154      +78     
- Partials      894      895       +1     

codecov-commenter avatar Mar 16 '24 14:03 codecov-commenter

@jsternberg's PR https://github.com/docker/cli/pull/4889 just got merged 🥳

Can you rebase and see if everything's fine @krissetto?

laurazard avatar Mar 25 '24 16:03 laurazard

Just so I don't forget this, can you get code into telemetry.go to accept a OTEL_EXPORTER_OTLP_ENDPOINT env var in this PR too @krissetto?

laurazard avatar Mar 27 '24 13:03 laurazard

@jsternberg wanna take a final look? :')

laurazard avatar Mar 28 '24 16:03 laurazard