Skip to content

Commit

Permalink
[chore] Replace internal/datadog with datadog agent packages (#33233)
Browse files Browse the repository at this point in the history
**Description:** 

Remove internal/datadog package, replace with datadog-agent packages.

Follow-up of DataDog/datadog-agent#25841
  • Loading branch information
songy23 authored May 29, 2024
1 parent 15dde8a commit f7be511
Show file tree
Hide file tree
Showing 30 changed files with 45 additions and 1,075 deletions.
1 change: 0 additions & 1 deletion .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@ extension/sumologicextension/ @open-telemetry/collect
internal/aws/ @open-telemetry/collector-contrib-approvers @Aneurysm9 @mxiamxia
internal/collectd/ @open-telemetry/collector-contrib-approvers @atoulme
internal/coreinternal/ @open-telemetry/collector-contrib-approvers @open-telemetry/collector-approvers
internal/datadog/ @open-telemetry/collector-contrib-approvers @mx-psi @dineshg13
internal/docker/ @open-telemetry/collector-contrib-approvers @rmfitzpatrick @jamesmoessis
internal/exp/metrics/ @open-telemetry/collector-contrib-approvers @sh0rez @RichieSams
internal/filter/ @open-telemetry/collector-contrib-approvers @open-telemetry/collector-approvers
Expand Down
1 change: 0 additions & 1 deletion .github/ISSUE_TEMPLATE/bug_report.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,6 @@ body:
- internal/aws
- internal/collectd
- internal/core
- internal/datadog
- internal/docker
- internal/exp/metrics
- internal/filter
Expand Down
1 change: 0 additions & 1 deletion .github/ISSUE_TEMPLATE/feature_request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@ body:
- internal/aws
- internal/collectd
- internal/core
- internal/datadog
- internal/docker
- internal/exp/metrics
- internal/filter
Expand Down
1 change: 0 additions & 1 deletion .github/ISSUE_TEMPLATE/other.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@ body:
- internal/aws
- internal/collectd
- internal/core
- internal/datadog
- internal/docker
- internal/exp/metrics
- internal/filter
Expand Down
1 change: 0 additions & 1 deletion .github/ISSUE_TEMPLATE/unmaintained.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ body:
- internal/aws
- internal/collectd
- internal/core
- internal/datadog
- internal/docker
- internal/exp/metrics
- internal/filter
Expand Down
5 changes: 2 additions & 3 deletions cmd/configschema/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,8 @@ require (
github.com/DataDog/datadog-agent/comp/otelcol/logsagentpipeline v0.54.0-rc.5 // indirect
github.com/DataDog/datadog-agent/comp/otelcol/logsagentpipeline/logsagentpipelineimpl v0.54.0-rc.5 // indirect
github.com/DataDog/datadog-agent/comp/otelcol/otlp/components/exporter/logsagentexporter v0.54.0-rc.5 // indirect
github.com/DataDog/datadog-agent/comp/otelcol/otlp/components/metricsclient v0.0.0-20240525065430-d0b647bcb646 // indirect
github.com/DataDog/datadog-agent/comp/otelcol/otlp/components/statsprocessor v0.0.0-20240525065430-d0b647bcb646 // indirect
github.com/DataDog/datadog-agent/pkg/collector/check/defaults v0.54.0-rc.5 // indirect
github.com/DataDog/datadog-agent/pkg/config/env v0.54.0-rc.5 // indirect
github.com/DataDog/datadog-agent/pkg/config/model v0.54.0-rc.5 // indirect
Expand Down Expand Up @@ -562,7 +564,6 @@ require (
github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/xray v0.101.0 // indirect
github.com/open-telemetry/opentelemetry-collector-contrib/internal/collectd v0.101.0 // indirect
github.com/open-telemetry/opentelemetry-collector-contrib/internal/common v0.101.0 // indirect
github.com/open-telemetry/opentelemetry-collector-contrib/internal/datadog v0.101.0 // indirect
github.com/open-telemetry/opentelemetry-collector-contrib/internal/kafka v0.101.0 // indirect
github.com/open-telemetry/opentelemetry-collector-contrib/internal/sharedcomponent v0.101.0 // indirect
github.com/open-telemetry/opentelemetry-collector-contrib/pkg/experimentalmetricmetadata v0.101.0 // indirect
Expand Down Expand Up @@ -1187,8 +1188,6 @@ replace github.com/open-telemetry/opentelemetry-collector-contrib/extension/obse

replace github.com/open-telemetry/opentelemetry-collector-contrib/internal/k8stest => ../../internal/k8stest

replace github.com/open-telemetry/opentelemetry-collector-contrib/internal/datadog => ../../internal/datadog

replace github.com/open-telemetry/opentelemetry-collector-contrib/extension/jaegerremotesampling => ../../extension/jaegerremotesampling

replace github.com/open-telemetry/opentelemetry-collector-contrib => ../..
Expand Down
4 changes: 4 additions & 0 deletions cmd/configschema/go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion cmd/otelcontribcol/builder-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,6 @@ replaces:
- github.com/open-telemetry/opentelemetry-collector-contrib/exporter/cassandraexporter => ../../exporter/cassandraexporter
- github.com/open-telemetry/opentelemetry-collector-contrib/receiver/udplogreceiver => ../../receiver/udplogreceiver
- github.com/open-telemetry/opentelemetry-collector-contrib/internal/splunk => ../../internal/splunk
- github.com/open-telemetry/opentelemetry-collector-contrib/internal/datadog => ../../internal/datadog
- github.com/open-telemetry/opentelemetry-collector-contrib/receiver/podmanreceiver => ../../receiver/podmanreceiver
- github.com/open-telemetry/opentelemetry-collector-contrib/receiver/flinkmetricsreceiver => ../../receiver/flinkmetricsreceiver
- github.com/open-telemetry/opentelemetry-collector-contrib/receiver/awsecscontainermetricsreceiver => ../../receiver/awsecscontainermetricsreceiver
Expand Down
5 changes: 2 additions & 3 deletions cmd/otelcontribcol/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,8 @@ require (
github.com/DataDog/datadog-agent/comp/otelcol/logsagentpipeline v0.54.0-rc.5 // indirect
github.com/DataDog/datadog-agent/comp/otelcol/logsagentpipeline/logsagentpipelineimpl v0.54.0-rc.5 // indirect
github.com/DataDog/datadog-agent/comp/otelcol/otlp/components/exporter/logsagentexporter v0.54.0-rc.5 // indirect
github.com/DataDog/datadog-agent/comp/otelcol/otlp/components/metricsclient v0.0.0-20240525065430-d0b647bcb646 // indirect
github.com/DataDog/datadog-agent/comp/otelcol/otlp/components/statsprocessor v0.0.0-20240525065430-d0b647bcb646 // indirect
github.com/DataDog/datadog-agent/pkg/collector/check/defaults v0.54.0-rc.5 // indirect
github.com/DataDog/datadog-agent/pkg/config/env v0.54.0-rc.5 // indirect
github.com/DataDog/datadog-agent/pkg/config/model v0.54.0-rc.5 // indirect
Expand Down Expand Up @@ -614,7 +616,6 @@ require (
github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/xray v0.101.0 // indirect
github.com/open-telemetry/opentelemetry-collector-contrib/internal/collectd v0.101.0 // indirect
github.com/open-telemetry/opentelemetry-collector-contrib/internal/coreinternal v0.101.0 // indirect
github.com/open-telemetry/opentelemetry-collector-contrib/internal/datadog v0.101.0 // indirect
github.com/open-telemetry/opentelemetry-collector-contrib/internal/docker v0.101.0 // indirect
github.com/open-telemetry/opentelemetry-collector-contrib/internal/exp/metrics v0.101.0 // indirect
github.com/open-telemetry/opentelemetry-collector-contrib/internal/filter v0.101.0 // indirect
Expand Down Expand Up @@ -888,8 +889,6 @@ replace github.com/open-telemetry/opentelemetry-collector-contrib/receiver/udplo

replace github.com/open-telemetry/opentelemetry-collector-contrib/internal/splunk => ../../internal/splunk

replace github.com/open-telemetry/opentelemetry-collector-contrib/internal/datadog => ../../internal/datadog

replace github.com/open-telemetry/opentelemetry-collector-contrib/receiver/podmanreceiver => ../../receiver/podmanreceiver

replace github.com/open-telemetry/opentelemetry-collector-contrib/receiver/flinkmetricsreceiver => ../../receiver/flinkmetricsreceiver
Expand Down
4 changes: 4 additions & 0 deletions cmd/otelcontribcol/go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 4 additions & 5 deletions connector/datadogconnector/connector.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"sync"
"time"

"github.com/DataDog/datadog-agent/comp/otelcol/otlp/components/statsprocessor"
pb "github.com/DataDog/datadog-agent/pkg/proto/pbgo/trace"
traceconfig "github.com/DataDog/datadog-agent/pkg/trace/config"
"github.com/DataDog/datadog-agent/pkg/trace/timing"
Expand All @@ -23,8 +24,6 @@ import (
semconv "go.opentelemetry.io/collector/semconv/v1.17.0"
"go.opentelemetry.io/otel/metric/noop"
"go.uber.org/zap"

"github.com/open-telemetry/opentelemetry-collector-contrib/internal/datadog"
)

// traceToMetricConnector is the schema for connector
Expand All @@ -34,7 +33,7 @@ type traceToMetricConnector struct {

// agent specifies the agent used to ingest traces and output APM Stats.
// It is implemented by the traceagent structure; replaced in tests.
agent datadog.Ingester
agent statsprocessor.Ingester

// translator specifies the translator used to transform APM Stats Payloads
// from the agent to OTLP Metrics.
Expand Down Expand Up @@ -88,7 +87,7 @@ func newTraceToMetricConnector(set component.TelemetrySettings, cfg component.Co
ctx := context.Background()
return &traceToMetricConnector{
logger: set.Logger,
agent: datadog.NewAgentWithConfig(ctx, getTraceAgentCfg(set.Logger, cfg.(*Config).Traces, attributesTranslator), in, metricsClient, timingReporter),
agent: statsprocessor.NewAgentWithConfig(ctx, getTraceAgentCfg(set.Logger, cfg.(*Config).Traces, attributesTranslator), in, metricsClient, timingReporter),
translator: trans,
in: in,
metricsConsumer: metricsConsumer,
Expand Down Expand Up @@ -133,7 +132,7 @@ func (c *traceToMetricConnector) Start(_ context.Context, _ component.Host) erro
// Shutdown implements the component.Component interface.
func (c *traceToMetricConnector) Shutdown(context.Context) error {
if !c.isStarted {
// Note: it is not necessary to manually close c.exit, c.in and c.agent.(*datadog.TraceAgent).exit channels as these are unused.
// Note: it is not necessary to manually close c.exit, c.in and c.agent.(*statsprocessor.TraceAgent).exit channels as these are unused.
c.logger.Info("Requested shutdown, but not started, ignoring.")
return nil
}
Expand Down
4 changes: 2 additions & 2 deletions connector/datadogconnector/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ package datadogconnector // import "github.com/open-telemetry/opentelemetry-coll
import (
"context"

"github.com/DataDog/datadog-agent/comp/otelcol/otlp/components/metricsclient"
"github.com/DataDog/datadog-agent/pkg/trace/timing"
"go.opentelemetry.io/collector/component"
"go.opentelemetry.io/collector/connector"
"go.opentelemetry.io/collector/consumer"

"github.com/open-telemetry/opentelemetry-collector-contrib/connector/datadogconnector/internal/metadata"
"github.com/open-telemetry/opentelemetry-collector-contrib/internal/datadog"
)

// NewFactory creates a factory for tailtracer connector.
Expand All @@ -39,7 +39,7 @@ func createDefaultConfig() component.Config {
// defines the consumer type of the connector
// we want to consume traces and export metrics therefore define nextConsumer as metrics, consumer is the next component in the pipeline
func createTracesToMetricsConnector(_ context.Context, params connector.CreateSettings, cfg component.Config, nextConsumer consumer.Metrics) (connector.Traces, error) {
metricsClient := datadog.InitializeMetricClient(params.MeterProvider, datadog.ConnectorSourceTag)
metricsClient := metricsclient.InitializeMetricClient(params.MeterProvider, metricsclient.ConnectorSourceTag)
timingReporter := timing.New(metricsClient)
c, err := newTraceToMetricConnector(params.TelemetrySettings, cfg, nextConsumer, metricsClient, timingReporter)
if err != nil {
Expand Down
5 changes: 2 additions & 3 deletions connector/datadogconnector/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@ module github.com/open-telemetry/opentelemetry-collector-contrib/connector/datad
go 1.21.0

require (
github.com/DataDog/datadog-agent/comp/otelcol/otlp/components/metricsclient v0.0.0-20240525065430-d0b647bcb646
github.com/DataDog/datadog-agent/comp/otelcol/otlp/components/statsprocessor v0.0.0-20240525065430-d0b647bcb646
github.com/DataDog/datadog-agent/pkg/proto v0.54.0-rc.5
github.com/DataDog/datadog-agent/pkg/trace v0.54.0-rc.5
github.com/DataDog/datadog-go/v5 v5.5.0
github.com/DataDog/opentelemetry-mapping-go/pkg/otlp/attributes v0.16.1
github.com/DataDog/opentelemetry-mapping-go/pkg/otlp/metrics v0.16.1
github.com/open-telemetry/opentelemetry-collector-contrib/exporter/datadogexporter v0.101.0
github.com/open-telemetry/opentelemetry-collector-contrib/internal/datadog v0.101.0
github.com/open-telemetry/opentelemetry-collector-contrib/processor/tailsamplingprocessor v0.101.0
github.com/patrickmn/go-cache v2.1.0+incompatible
github.com/stretchr/testify v1.9.0
Expand Down Expand Up @@ -275,8 +276,6 @@ require (
sigs.k8s.io/yaml v1.3.0 // indirect
)

replace github.com/open-telemetry/opentelemetry-collector-contrib/internal/datadog => ../../internal/datadog

replace github.com/open-telemetry/opentelemetry-collector-contrib/processor/tailsamplingprocessor => ../../processor/tailsamplingprocessor

replace github.com/open-telemetry/opentelemetry-collector-contrib/internal/metadataproviders => ../../internal/metadataproviders
Expand Down
4 changes: 4 additions & 0 deletions connector/datadogconnector/go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions exporter/datadogexporter/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"time"

"github.com/DataDog/datadog-agent/comp/otelcol/logsagentpipeline"
"github.com/DataDog/datadog-agent/comp/otelcol/otlp/components/metricsclient"
pb "github.com/DataDog/datadog-agent/pkg/proto/pbgo/trace"
"github.com/DataDog/datadog-agent/pkg/trace/agent"
"github.com/DataDog/datadog-agent/pkg/trace/telemetry"
Expand All @@ -36,7 +37,6 @@ import (

"github.com/open-telemetry/opentelemetry-collector-contrib/exporter/datadogexporter/internal/hostmetadata"
"github.com/open-telemetry/opentelemetry-collector-contrib/exporter/datadogexporter/internal/metadata"
"github.com/open-telemetry/opentelemetry-collector-contrib/internal/datadog"
"github.com/open-telemetry/opentelemetry-collector-contrib/pkg/resourcetotelemetry"
)

Expand Down Expand Up @@ -151,7 +151,7 @@ func (f *factory) StopReporter() {
}

func (f *factory) TraceAgent(ctx context.Context, params exporter.CreateSettings, cfg *Config, sourceProvider source.Provider, attrsTranslator *attributes.Translator) (*agent.Agent, error) {
agnt, err := newTraceAgent(ctx, params, cfg, sourceProvider, datadog.InitializeMetricClient(params.MeterProvider, datadog.ExporterSourceTag), attrsTranslator)
agnt, err := newTraceAgent(ctx, params, cfg, sourceProvider, metricsclient.InitializeMetricClient(params.MeterProvider, metricsclient.ExporterSourceTag), attrsTranslator)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -312,7 +312,7 @@ func (f *factory) createMetricsExporter(
return nil, err
}
statsToAgent := make(chan *pb.StatsPayload)
metricsClient := datadog.InitializeMetricClient(set.MeterProvider, datadog.ExporterSourceTag)
metricsClient := metricsclient.InitializeMetricClient(set.MeterProvider, metricsclient.ExporterSourceTag)
timingReporter := timing.New(metricsClient)
statsWriter := writer.NewStatsWriter(acfg, statsToAgent, telemetry.NewNoopCollector(), metricsClient, timingReporter)

Expand Down
Loading

0 comments on commit f7be511

Please sign in to comment.