Skip to content

Conversation

@Benehiko
Copy link
Contributor

@Benehiko Benehiko commented Mar 6, 2024

This is a WIP and a breaking change to the docker client APIs. Most likely required by OTEL for better tracing.

Relates to

- What I did

Add context to more of the docker client function calls.

- How I did it

- How to verify it

- Description for the changelog

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

Signed-off-by: Alano Terblanche <18033717+Benehiko@users.noreply.github.com>
@laurazard laurazard added area/api API kind/enhancement Enhancements are not bugs or new features but can improve usability or performance. labels Mar 6, 2024
Comment on lines +294 to 296
func (cli *Client) ClientVersion(_ context.Context) string {
return cli.version
}
Copy link
Member

Choose a reason for hiding this comment

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

Doesn't look like we're using it here, so not sure we should add

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think it might be necessary if we want full trace visibility of the call stack from otel. But I could be wrong here and maybe it's unnecessary as you say

Comment on lines -182 to 183
// )
func NewClientWithOpts(ops ...Opt) (*Client, error) {
func NewClientWithOpts(ctx context.Context, ops ...Opt) (*Client, error) {
hostURL, err := ParseHostURL(DefaultDockerHost)
Copy link
Member

Choose a reason for hiding this comment

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

This will likely be the tricky bit to look at; should a client get a context, or should the context be scoped to an action (like client.MakeSomeAPIRequest). I'm included to say for the client, it would be the latter (per call), and it may be up to the consumer of the client to keep a "global" context if things must be inherited from that. 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think this is a similar argument of otel trace visibility over actual context usage (like cancelling io bound tasks).

Signed-off-by: Alano Terblanche <18033717+Benehiko@users.noreply.github.com>
@Benehiko Benehiko closed this by deleting the head repository Apr 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/api API kind/enhancement Enhancements are not bugs or new features but can improve usability or performance.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants