Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[exporter/datadogexporter, pkg/datadog, testbed] Use NewDefaultClientConfig instead of manually creating struct #35519

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions exporter/datadogexporter/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,10 +190,9 @@ func NewFactory() exporter.Factory {
}

func defaultClientConfig() confighttp.ClientConfig {
// do not use NewDefaultClientConfig for backwards-compatibility
songy23 marked this conversation as resolved.
Show resolved Hide resolved
return confighttp.ClientConfig{
Timeout: 15 * time.Second,
}
client := confighttp.NewDefaultClientConfig()
client.Timeout = 15 * time.Second
return client
}

// createDefaultConfig creates the default exporter configuration
Expand Down
9 changes: 4 additions & 5 deletions pkg/datadog/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ func validateClientConfig(cfg confighttp.ClientConfig) error {
if cfg.Compression != "" {
unsupported = append(unsupported, "compression")
}
if cfg.Headers != nil {
if len(cfg.Headers) > 0 {
unsupported = append(unsupported, "headers")
}
if cfg.HTTP2ReadIdleTimeout != 0 {
Expand Down Expand Up @@ -281,10 +281,9 @@ func (c *Config) Unmarshal(configMap *confmap.Conf) error {
}

func defaultClientConfig() confighttp.ClientConfig {
// do not use NewDefaultClientConfig for backwards-compatibility
return confighttp.ClientConfig{
Timeout: 15 * time.Second,
}
client := confighttp.NewDefaultClientConfig()
client.Timeout = 15 * time.Second
return client
}

// CreateDefaultConfig creates the default exporter configuration
Expand Down
6 changes: 3 additions & 3 deletions testbed/mockdatasenders/mockdatadogagentexporter/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ func NewFactory() exporter.Factory {

// CreateDefaultConfig creates the default configuration for DDAPM Exporter
func createDefaultConfig() component.Config {
return &Config{
ClientConfig: confighttp.ClientConfig{Endpoint: "localhost:8126"},
}
client := confighttp.NewDefaultClientConfig()
client.Endpoint = "localhost:8126"
return client
}

func CreateTracesExporter(
Expand Down