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
3 changes: 1 addition & 2 deletions exporter/datadogexporter/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"regexp"
"strings"

"github.com/DataDog/datadog-agent/pkg/util/hostname/validate"
"go.opentelemetry.io/collector/component"
"go.opentelemetry.io/collector/config/confighttp"
"go.opentelemetry.io/collector/config/confignet"
Expand All @@ -18,8 +19,6 @@ import (
"go.opentelemetry.io/collector/confmap"
"go.opentelemetry.io/collector/exporter/exporterhelper"
"go.uber.org/zap"

"github.com/DataDog/datadog-agent/pkg/util/hostname/validate"
)

var (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ import (
"os"
"sync"

"github.com/DataDog/datadog-agent/pkg/util/hostname/validate"
"github.com/DataDog/datadog-agent/pkg/util/log"
"github.com/DataDog/opentelemetry-mapping-go/pkg/otlp/attributes/source"
"go.uber.org/zap"

"github.com/DataDog/datadog-agent/pkg/util/hostname/validate"
)

type HostInfo struct {
Expand All @@ -23,6 +23,7 @@ type HostInfo struct {
// GetHostInfo gets system information about the hostname
func GetHostInfo(logger *zap.Logger) (hostInfo *HostInfo) {
hostInfo = &HostInfo{}
defer log.Flush()

if hostname, err := getSystemFQDN(); err == nil {
hostInfo.FQDN = hostname
Expand All @@ -41,6 +42,7 @@ func GetHostInfo(logger *zap.Logger) (hostInfo *HostInfo) {

// GetHostname gets the hostname provided by the system
func (hi *HostInfo) GetHostname(logger *zap.Logger) string {
defer log.Flush()
if hi.FQDN == "" {
// Don't report failure since FQDN was just not available
return hi.OS
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,7 @@ import (
)

func TestMain(m *testing.M) {
goleak.VerifyTestMain(m)
goleak.VerifyTestMain(m,
goleak.IgnoreAnyFunction("github.com/cihub/seelog.(*asyncLoopLogger).processQueue"),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this? Can you add a tracking issue?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@crobert-1 Could you help us with the best way to deal with this? (e.g. is there a template for tracking issues?)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see a need to track it.

We aim to have no leaks at all in the Collector, this should be tracked and eventually fixed in the Agent.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Created internal jira to track this work in Agent.

Copy link
Member

@crobert-1 crobert-1 Jul 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add frequency and information to this issue: cihub/seelog#182

Also, please add a reference in this file to that issue so that we have future context for why this ignore is necessary.

Since this goroutine is started during a dependency's init(), there's nothing we can do if we need to import the package that depends on it. It's okay to ignore for now.

)
}
Loading