Skip to content

Commit

Permalink
[receiver/dockerstats] remove duplicate Timeout setting (#26114)
Browse files Browse the repository at this point in the history
Use the Timeout setting from ScraperHelper instead

---------

Signed-off-by: Alex Boten <[email protected]>
  • Loading branch information
Alex Boten committed Aug 30, 2023
1 parent 56ddbc3 commit 7f452e5
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 6 deletions.
27 changes: 27 additions & 0 deletions .chloggen/codeboten_rm-dupe-dockerstats.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Use this changelog template to create an entry for release notes.

# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
change_type: breaking

# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver)
component: dockerstatsreceiver

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: "Removes duplicate `Timeout` field. This change has no impact on end users of the component."

# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
issues: [26114]

# (Optional) One or more lines of additional information to render under the primary note.
# These lines will be padded with 2 spaces and then inserted directly into the document.
# Use pipe (|) for multiline entries.
subtext:

# If your change doesn't affect end users or the exported elements of any package,
# you should instead start your pull request title with [chore] or use the "Skip Changelog" label.
# Optional: The change log or logs in which this entry should be included.
# e.g. '[user]' or '[user, api]'
# Include 'user' if the change is relevant to end users.
# Include 'api' if there is a change to a library API.
# Default: '[user]'
change_logs: [api]
4 changes: 0 additions & 4 deletions receiver/dockerstatsreceiver/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ package dockerstatsreceiver // import "github.com/open-telemetry/opentelemetry-c
import (
"errors"
"fmt"
"time"

"go.opentelemetry.io/collector/component"
"go.opentelemetry.io/collector/receiver/scraperhelper"
Expand All @@ -21,9 +20,6 @@ type Config struct {
// The URL of the docker server. Default is "unix:///var/run/docker.sock"
Endpoint string `mapstructure:"endpoint"`

// The maximum amount of time to wait for docker API responses. Default is 5s
Timeout time.Duration `mapstructure:"timeout"`

// A mapping of container label names to MetricDescriptor label keys.
// The corresponding container label value will become the DataPoint label value
// for the mapped name. E.g. `io.kubernetes.container.name: container_spec_name`
Expand Down
1 change: 0 additions & 1 deletion receiver/dockerstatsreceiver/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ func TestLoadConfig(t *testing.T) {
},

Endpoint: "http://example.com/",
Timeout: 20 * time.Second,
DockerAPIVersion: 1.24,

ExcludedImages: []string{
Expand Down
2 changes: 1 addition & 1 deletion receiver/dockerstatsreceiver/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ func NewFactory() rcvr.Factory {
func createDefaultConfig() component.Config {
scs := scraperhelper.NewDefaultScraperControllerSettings(metadata.Type)
scs.CollectionInterval = 10 * time.Second
scs.Timeout = 5 * time.Second
return &Config{
ScraperControllerSettings: scs,
Endpoint: "unix:///var/run/docker.sock",
Timeout: 5 * time.Second,
DockerAPIVersion: defaultDockerAPIVersion,
MetricsBuilderConfig: metadata.DefaultMetricsBuilderConfig(),
}
Expand Down

0 comments on commit 7f452e5

Please sign in to comment.