Skip to content

Conversation

@IbraheemA
Copy link
Contributor

Description

The majority of logic between the datadog-agent fork of datadogconnector and the copy in this repo is shared. Factor out that shared logic into pkg/datadog so that it can be imported in datadog-agent.

Pin google.golang.org/genproto version to avoid ambiguous import issue that caused conflict between different versions of the dependency pulled in by different components

Copy link
Member

@songy23 songy23 left a comment

Choose a reason for hiding this comment

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

From high level I feel you moved too many to pkg/datadog and left too few in connector/datadog (only the factory.go file?), which doesn't seem idiomatic. WDYT @mx-psi

// SPDX-License-Identifier: Apache-2.0

package datadogconnector // import "github.com/open-telemetry/opentelemetry-collector-contrib/connector/datadogconnector"
package apmstats // import "github.com/open-telemetry/opentelemetry-collector-contrib/pkg/datadog/apmstats"
Copy link
Member

Choose a reason for hiding this comment

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

Does this file need to be moved? It's just a benchmark test

// SPDX-License-Identifier: Apache-2.0

package datadogconnector // import "github.com/open-telemetry/opentelemetry-collector-contrib/connector/datadogconnector"
package apmstats // import "github.com/open-telemetry/opentelemetry-collector-contrib/pkg/datadog/apmstats"
Copy link
Member

Choose a reason for hiding this comment

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

I think this file can stay in connector since most code is already in pkg/datadog/config

}

func getTraceAgentCfg(logger *zap.Logger, cfg datadogconfig.TracesConnectorConfig, attributesTranslator *attributes.Translator) *config.AgentConfig {
func getTraceAgentCfg(logger *zap.Logger, cfg datadogconfig.TracesConnectorConfig, attributesTranslator *attributes.Translator, tagger types.TaggerClient, hostnameOpt option.Option[string]) *config.AgentConfig {
Copy link
Member

Choose a reason for hiding this comment

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

Apart from this function, can the rest of this file stay in the connector package?

Comment on lines +300 to +301
// Replace old monolithic genproto with newer version to avoid ambiguous import with split modules
replace google.golang.org/genproto => google.golang.org/genproto v0.0.0-20231030173426-d783a09b4405
Copy link
Member

Choose a reason for hiding this comment

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

We should not do this, this only pins the dependency on this module but not on any modules that import this one, which means any customer using Datadog components on a custom build may have to add this replace to their Collector builder configuraiton

From https://go.dev/ref/mod#go-mod-file-replace:

replace directives only apply in the main module’s go.mod file and are ignored in other modules

@mx-psi
Copy link
Member

mx-psi commented Oct 20, 2025

From high level I feel you moved too many to pkg/datadog and left too few in connector/datadog (only the factory.go file?), which doesn't seem idiomatic. WDYT @mx-psi

I agree, I think we should move as little as possible

@IbraheemA
Copy link
Contributor Author

Changed the approach based on comments, closing and replacing with #43755

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants