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] Use Agent modules for validating hostname #34030

Merged
Show file tree
Hide file tree
Changes from 1 commit
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
4 changes: 2 additions & 2 deletions exporter/datadogexporter/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (
"go.opentelemetry.io/collector/exporter/exporterhelper"
"go.uber.org/zap"

"github.com/open-telemetry/opentelemetry-collector-contrib/exporter/datadogexporter/internal/hostmetadata/valid"
"github.com/DataDog/datadog-agent/pkg/util/hostname/validate"
)

var (
Expand Down Expand Up @@ -469,7 +469,7 @@ func (c *Config) Validate() error {
return errNoMetadata
}

if err := valid.Hostname(c.Hostname); c.Hostname != "" && err != nil {
if err := validate.ValidHostname(c.Hostname); c.Hostname != "" && err != nil {
return fmt.Errorf("hostname field is invalid: %w", err)
}

Expand Down
6 changes: 4 additions & 2 deletions exporter/datadogexporter/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,10 @@ require (
k8s.io/client-go v0.29.3
)

require github.com/DataDog/datadog-agent/comp/trace/compression/impl-gzip v0.56.0-rc.1
require (
github.com/DataDog/datadog-agent/comp/trace/compression/impl-gzip v0.56.0-rc.1
github.com/DataDog/datadog-agent/pkg/util/hostname/validate v0.56.0-rc.1
)
dineshg13 marked this conversation as resolved.
Show resolved Hide resolved

require (
cloud.google.com/go/auth v0.5.1 // indirect
Expand Down Expand Up @@ -123,7 +126,6 @@ require (
github.com/DataDog/datadog-agent/pkg/util/executable v0.56.0-rc.1 // indirect
github.com/DataDog/datadog-agent/pkg/util/filesystem v0.56.0-rc.1 // indirect
github.com/DataDog/datadog-agent/pkg/util/fxutil v0.56.0-rc.1 // indirect
github.com/DataDog/datadog-agent/pkg/util/hostname/validate v0.56.0-rc.1 // indirect
github.com/DataDog/datadog-agent/pkg/util/http v0.56.0-rc.1 // indirect
github.com/DataDog/datadog-agent/pkg/util/log v0.56.0-rc.1 // indirect
github.com/DataDog/datadog-agent/pkg/util/optional v0.56.0-rc.1 // indirect
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"github.com/DataDog/opentelemetry-mapping-go/pkg/otlp/attributes/source"
"go.uber.org/zap"

"github.com/open-telemetry/opentelemetry-collector-contrib/exporter/datadogexporter/internal/hostmetadata/valid"
"github.com/DataDog/datadog-agent/pkg/util/hostname/validate"
)

type HostInfo struct {
Expand Down Expand Up @@ -44,7 +44,7 @@ func (hi *HostInfo) GetHostname(logger *zap.Logger) string {
if hi.FQDN == "" {
// Don't report failure since FQDN was just not available
return hi.OS
} else if err := valid.Hostname(hi.FQDN); err != nil {
} else if err := validate.ValidHostname(hi.FQDN); err != nil {
logger.Info("FQDN is not valid", zap.Error(err))
return hi.OS
}
Expand Down

This file was deleted.

53 changes: 0 additions & 53 deletions exporter/datadogexporter/internal/hostmetadata/valid/valid.go

This file was deleted.

This file was deleted.

Loading