-
Notifications
You must be signed in to change notification settings - Fork 5.3k
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
feat(cli): report more useful User-Agent on engine API requests #11333
Conversation
When using the Moby/Docker Engine API client, we do not have a useful user agent value being reported. Ideally, in the future, the Docker CLI will set this appropriately for plugins when it initializes the client. For now, manually set it, which is a bit hacky because it requires some casting & manually invoking an option function that's technically meant for initialization. In practice, this is pretty safe - the cast is checked defensively and we ignore any errors (which shouldn't be possible anyway). Signed-off-by: Milas Bowman <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #11333 +/- ##
==========================================
- Coverage 56.69% 56.66% -0.03%
==========================================
Files 134 134
Lines 11448 11461 +13
==========================================
+ Hits 6490 6494 +4
- Misses 4336 4342 +6
- Partials 622 625 +3 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, but I wonder we are in a hurry to get this and have to introduce such a hack. Can't we just wait for #4574 to be approved ?
This will allow us to remove hacks on the Docker Desktop side, and we don't know when the next release of Docker CLI with the Milas' PR will be done |
Looks like this fixes; |
What I did
When using the Moby/Docker Engine API client, we do not have a useful user agent value being reported. Ideally, in the future, the Docker CLI will set this appropriately for plugins when it initializes the client.
For now, manually set it, which is a bit hacky because it requires some casting & manually invoking an option function that's technically meant for initialization. In practice, this is pretty safe - the cast is checked defensively and we ignore any errors (which shouldn't be possible anyway).
(not mandatory) A picture of a cute animal, if possible in relation to what you did
![two rats snuggling](https://private-user-images.githubusercontent.com/841263/295672426-9ef6db17-7240-4c57-b2a3-800ef0169afd.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk2MDU4OTksIm5iZiI6MTczOTYwNTU5OSwicGF0aCI6Ii84NDEyNjMvMjk1NjcyNDI2LTllZjZkYjE3LTcyNDAtNGM1Ny1iMmEzLTgwMGVmMDE2OWFmZC5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjE1JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIxNVQwNzQ2MzlaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT01ZDBkNWU4OWE1ZDMxMGJmNzkxZmE4NTExMDQ2YjQ2ZWM0MTJjMzhlZjgyNGQ5OWM5ODJkNjkyNzViYjRkMWJlJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.Nzbjgm0GFlwfhLVrQY50zTOiqs3m-phG-I7nIIciVks)