Skip to content

containerd: add c8d version and storage-driver to User-Agent#45670

Merged
thaJeztah merged 5 commits intomoby:masterfrom
thaJeztah:c8d_useragent_more_details
Jun 2, 2023
Merged

containerd: add c8d version and storage-driver to User-Agent#45670
thaJeztah merged 5 commits intomoby:masterfrom
thaJeztah:c8d_useragent_more_details

Conversation

@thaJeztah
Copy link
Copy Markdown
Member

dockerversion: add a basic unit-test

dockerversion: simplify escapeStr()

Use a const for the characters to escape, instead of implementing
this as a generic escaping function.

dockerversion: remove insertUpstreamUserAgent()

It was not really "inserting" anything, just formatting and appending.
Simplify this by changing this in to a getUpstreamUserAgent() function
which returns the upstream User-Agent (if any) into a UpstreamClient().

dockerversion: DockerUserAgent(): allow custom versions to be passed

Allow additional metadata to be passed as part of the generated User-Agent.

containerd: add c8d version and storage-driver to User-Agent

With this patch, the user-agent has information about the containerd-client
version and the storage-driver that's used when using the containerd-integration;

time="2023-06-01T11:27:07.959822887Z" level=info msg="listening on [::]:5000" go.version=go1.19.9 instance.id=53590f34-096a-4fd1-9c58-d3b8eb7e5092 service=registry version=2.8.2
...
172.18.0.1 - - [01/Jun/2023:11:30:12 +0000] "HEAD /v2/multifoo/blobs/sha256:c7ec7661263e5e597156f2281d97b160b91af56fa1fd2cc045061c7adac4babd HTTP/1.1" 404 157 "" "docker/dev go/go1.20.4 git-commit/8d67d0c1a8 kernel/5.15.49-linuxkit-pr os/linux arch/arm64 containerd-client/1.6.21+unknown storage-driver/overlayfs UpstreamClient(Docker-Client/24.0.2 \\(linux\\))"

- Description for the changelog

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

@thaJeztah thaJeztah added area/distribution Image Distribution status/2-code-review kind/enhancement Enhancements are not bugs or new features but can improve usability or performance. process/cherry-pick containerd-integration Issues and PRs related to containerd integration labels Jun 1, 2023
@thaJeztah
Copy link
Copy Markdown
Member Author

For easier reading; the User-Agent looks like;

docker/24.0.3 go/go1.20.4 git-commit/8d67d0c1a8 kernel/5.15.49-linuxkit-pr os/linux arch/arm64 containerd-client/1.6.21+unknown storage-driver/overlayfs UpstreamClient(Docker-Client/24.0.2 \(linux\))

The added fields are:

containerd-client/1.6.21+unknown storage-driver/overlayfs

thaJeztah added 5 commits June 1, 2023 18:21
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Use a const for the characters to escape, instead of implementing
this as a generic escaping function.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
It was not really "inserting" anything, just formatting and appending.
Simplify this by changing this in to a `getUpstreamUserAgent()` function
which returns the upstream User-Agent (if any) into a `UpstreamClient()`.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Allow additional metadata to be passed as part of the generated User-Agent.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
With this patch, the user-agent has information about the containerd-client
version and the storage-driver that's used when using the containerd-integration;

    time="2023-06-01T11:27:07.959822887Z" level=info msg="listening on [::]:5000" go.version=go1.19.9 instance.id=53590f34-096a-4fd1-9c58-d3b8eb7e5092 service=registry version=2.8.2
    ...
    172.18.0.1 - - [01/Jun/2023:11:30:12 +0000] "HEAD /v2/multifoo/blobs/sha256:c7ec7661263e5e597156f2281d97b160b91af56fa1fd2cc045061c7adac4babd HTTP/1.1" 404 157 "" "docker/dev go/go1.20.4 git-commit/8d67d0c1a8 kernel/5.15.49-linuxkit-pr os/linux arch/arm64 containerd-client/1.6.21+unknown storage-driver/overlayfs UpstreamClient(Docker-Client/24.0.2 \\(linux\\))"

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
@thaJeztah thaJeztah force-pushed the c8d_useragent_more_details branch from a0010c3 to d099e47 Compare June 1, 2023 16:22
@thaJeztah thaJeztah marked this pull request as ready for review June 1, 2023 16:22
@thaJeztah thaJeztah merged commit 79c7d26 into moby:master Jun 2, 2023
@thaJeztah thaJeztah deleted the c8d_useragent_more_details branch June 2, 2023 09:24
@thaJeztah thaJeztah added this to the 25.0.0 milestone Jun 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/distribution Image Distribution containerd-integration Issues and PRs related to containerd integration kind/enhancement Enhancements are not bugs or new features but can improve usability or performance. process/cherry-picked status/2-code-review

Projects

Development

Successfully merging this pull request may close these issues.

containerd-integration: set correct user-agent

3 participants