Skip to content

Commit 9a13dee

Browse files
authored
[extension/observer, receiver/dockerstats] Correct examples with api_version (open-telemetry#33992)
Changes examples for `api_version` to make sure they use a string instead of a float **Link to tracking Issue:** Required for open-telemetry/opentelemetry-collector/pull/10554
1 parent 4115aad commit 9a13dee

File tree

4 files changed

+5
-18
lines changed

4 files changed

+5
-18
lines changed

extension/observer/dockerobserver/README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ extensions:
3232
# list of container image names to exclude
3333
excluded_images: ['redis', 'another_image_name']
3434
# client API version, default to 1.24
35-
api_version: 1.25
35+
api_version: "1.25"
3636
# max amount of time to wait for a response from Docker API , default to 5s
3737
timeout: 15s
3838

@@ -63,9 +63,9 @@ default: `5s`
6363

6464
### `api_version`
6565

66-
The client API version. If using one with a terminating zero, input as a string to prevent undesired truncation (e.g. `"1.40"` instead of `1.40`, which is parsed as `1.4`).
66+
The client API version. Make sure you input it as a string instead of a float (e.g. `"1.4"` instead of `1.4`).
6767

68-
default: `1.24`
68+
default: `"1.24"`
6969

7070
### `excluded_images`
7171

extension/observer/dockerobserver/config_test.go

-10
Original file line numberDiff line numberDiff line change
@@ -43,16 +43,6 @@ func TestLoadConfig(t *testing.T) {
4343
DockerAPIVersion: version,
4444
},
4545
},
46-
{
47-
id: component.NewIDWithName(metadata.Type, "unsupported_api_version"),
48-
expected: &Config{
49-
Endpoint: "unix:///var/run/docker.sock",
50-
CacheSyncInterval: time.Hour,
51-
Timeout: 5 * time.Second,
52-
DockerAPIVersion: "1.4",
53-
},
54-
expectedError: `"api_version" 1.4 must be at least 1.24`,
55-
},
5646
}
5747
for _, tt := range tests {
5848
t.Run(tt.id.String(), func(t *testing.T) {

extension/observer/dockerobserver/testdata/config.yaml

-3
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,3 @@ docker_observer/ignore_non_host_bindings:
1616
ignore_non_host_bindings: true
1717
docker_observer/exclude_nginx:
1818
excluded_images: ["nginx"]
19-
docker_observer/unsupported_api_version:
20-
# intentionally a float since it will be parsed as 1.4
21-
api_version: 1.40

receiver/dockerstatsreceiver/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ only unmatched container image names should be excluded.
4040
- Globs are non-regex items (e.g. `/items/`) containing any of the following: `*[]{}?`. Negations are supported:
4141
`!my*container` will exclude all containers whose image name doesn't match the blob `my*container`.
4242
- `timeout` (default = `5s`): The request timeout for any docker daemon query.
43-
- `api_version` (default = `1.25`): The Docker client API version (must be 1.25+). If using one with a terminating zero, input as a string to prevent undesired truncation (e.g. `"1.40"` instead of `1.40`, which is parsed as `1.4`). [Docker API versions](https://docs.docker.com/engine/api/).
43+
- `api_version` (default = `"1.25"`): The Docker client API version (must be 1.25+). Must be input as a string, not a float (e.g. `"1.40"` instead of `1.40`). [Docker API versions](https://docs.docker.com/engine/api/).
4444
- `metrics` (defaults at [./documentation.md](./documentation.md)): Enables/disables individual metrics. See [./documentation.md](./documentation.md) for full detail.
4545

4646
Example:
@@ -51,7 +51,7 @@ receivers:
5151
endpoint: http://example.com/
5252
collection_interval: 2s
5353
timeout: 20s
54-
api_version: 1.24
54+
api_version: "1.24"
5555
container_labels_to_metric_labels:
5656
my.container.label: my-metric-label
5757
my.other.container.label: my-other-metric-label

0 commit comments

Comments
 (0)