Skip to content

Commit f108c70

Browse files
authored
(chore): Upgrading Docker API version default from 1.24 to 1.44 (#44411)
#### Description Docker Client API default has been upgraded from 1.24 to 1.44. The details of the requirements to this change has been given in the accompanying issue with docker upstream PRs. #### Link to tracking issue Fixes #44279 #### Testing Updated the unit tests and ran them.
1 parent 50062ff commit f108c70

File tree

8 files changed

+39
-12
lines changed

8 files changed

+39
-12
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Use this changelog template to create an entry for release notes.
2+
3+
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
4+
change_type: 'breaking'
5+
6+
# The name of the component, or a single word describing the area of concern, (e.g. receiver/filelog)
7+
component: 'extension/docker_observer'
8+
9+
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
10+
note: "Upgrading Docker API version default from 1.24 to 1.44"
11+
12+
# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
13+
issues: [44279]
14+
15+
# (Optional) One or more lines of additional information to render under the primary note.
16+
# These lines will be padded with 2 spaces and then inserted directly into the document.
17+
# Use pipe (|) for multiline entries.
18+
subtext:
19+
20+
# If your change doesn't affect end users or the exported elements of any package,
21+
# you should instead start your pull request title with [chore] or use the "Skip Changelog" label.
22+
# Optional: The change log or logs in which this entry should be included.
23+
# e.g. '[user]' or '[user, api]'
24+
# Include 'user' if the change is relevant to end users.
25+
# Include 'api' if there is a change to a library API.
26+
# Default: '[user]'
27+
change_logs: ['user']

extension/observer/dockerobserver/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ The Docker observer extension is a [Receiver Creator](../../../receiver/receiver
1717
container endpoints discovered through the Docker API. Only containers that are in the state of `Running` and not `Paused` will emit endpoints.
1818
This observer watches the Docker engine's stream of events to dynamically create, update, and remove endpoints as events are processed.
1919

20-
Requires Docker API Version 1.24+.
20+
Requires Docker API Version 1.44+.
2121

2222
The collector will need permissions to access the Docker Engine API, specifically it will need
2323
read access to the Docker socket (default `unix:///var/run/docker.sock` on non-Windows and `npipe:////./pipe/docker_engine` on Windows).
@@ -32,8 +32,8 @@ extensions:
3232
endpoint: my/path/to/docker.sock
3333
# list of container image names to exclude
3434
excluded_images: ['redis', 'another_image_name']
35-
# client API version, default to 1.24
36-
api_version: "1.25"
35+
# client API version, default to 1.44
36+
api_version: "1.44"
3737
# max amount of time to wait for a response from Docker API , default to 5s
3838
timeout: 15s
3939

@@ -66,7 +66,7 @@ default: `5s`
6666

6767
The client API version. Make sure you input it as a string instead of a float (e.g. `"1.4"` instead of `1.4`).
6868

69-
default: `"1.24"`
69+
default: `"1.44"`
7070

7171
### `excluded_images`
7272

extension/observer/dockerobserver/config_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import (
1919
"github.com/open-telemetry/opentelemetry-collector-contrib/internal/docker"
2020
)
2121

22-
var version = "1.40"
22+
var version = "1.45"
2323

2424
func TestLoadConfig(t *testing.T) {
2525
t.Parallel()
@@ -67,7 +67,7 @@ func TestValidateConfig(t *testing.T) {
6767
assert.ErrorContains(t, xconfmap.Validate(cfg), "endpoint must be specified")
6868

6969
cfg = &Config{Config: docker.Config{Endpoint: "someEndpoint", DockerAPIVersion: "1.23"}}
70-
assert.ErrorContains(t, xconfmap.Validate(cfg), `"api_version" 1.23 must be at least 1.24`)
70+
assert.ErrorContains(t, xconfmap.Validate(cfg), `"api_version" 1.23 must be at least 1.44`)
7171

7272
cfg = &Config{Config: docker.Config{Endpoint: "someEndpoint", DockerAPIVersion: version}}
7373
assert.ErrorContains(t, xconfmap.Validate(cfg), "timeout must be specified")
@@ -101,7 +101,7 @@ func TestApiVersionCustomError(t *testing.T) {
101101
cfg := factory.CreateDefaultConfig()
102102
err := sub.Unmarshal(cfg)
103103
assert.ErrorContains(t, err,
104-
`Hint: You may want to wrap the 'api_version' value in quotes (api_version: "1.40")`,
104+
`Hint: You may want to wrap the 'api_version' value in quotes (api_version: "1.45")`,
105105
)
106106

107107
sub = loadConf(t, "api_version_string.yaml", component.NewID(metadata.Type))

extension/observer/dockerobserver/extension.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import (
2323
)
2424

2525
var (
26-
defaultDockerAPIVersion = "1.24"
26+
defaultDockerAPIVersion = "1.44"
2727
minimumRequiredDockerAPIVersion = docker.MustNewAPIVersion(defaultDockerAPIVersion)
2828
)
2929

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
docker_observer:
2-
api_version: 1.40
2+
api_version: 1.45
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
docker_observer:
2-
api_version: "1.40"
2+
api_version: "1.45"

extension/observer/dockerobserver/testdata/config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ docker_observer/all_settings:
77
use_host_bindings: true
88
ignore_non_host_bindings: true
99
cache_sync_interval: 5m
10-
api_version: '1.40'
10+
api_version: '1.45'
1111
docker_observer/use_hostname_if_present:
1212
use_hostname_if_present: true
1313
docker_observer/use_host_bindings:

internal/docker/docker.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import (
2424

2525
const userAgent = "OpenTelemetry-Collector Docker Stats Receiver/v0.0.1"
2626

27-
var minimumRequiredDockerAPIVersion = MustNewAPIVersion("1.22")
27+
var minimumRequiredDockerAPIVersion = MustNewAPIVersion("1.44")
2828

2929
// Container is client.ContainerInspect() response container
3030
// stats and translated environment string map for potential labels.

0 commit comments

Comments
 (0)