Skip to content

Commit

Permalink
Update all github.com/datadog packages (open-telemetry#31398)
Browse files Browse the repository at this point in the history
Updates all datadog dependencies to the psuedo version from the
[otel/backport](https://github.com/DataDog/datadog-agent/tree/otel/backport)
branch and addresses the following breaking changes:
- DataDog/datadog-agent#22729
- DataDog/datadog-agent#22809

Functional changes:
- Initialize `OTLPReceiver.AttributesTranslator` in traces pipeline, and
set in trace agent configs
- Metrics client is no longer initalized in
`createTracesToTracesConnector` because there is no initialization of
the trace agent in the trace to trace connector
- `InitializeMetricClient` can be called multiple times now that the
singleton is gone
- `metrics_client.go` implements `Distribution` by calling `Histogram`
for the same implementation
- `metrics_client.go` adds placeholders for statsd methods that are not
applicable to our collector components
  • Loading branch information
liustanley committed Feb 29, 2024
1 parent 52ebb17 commit 47aa437
Show file tree
Hide file tree
Showing 27 changed files with 363 additions and 270 deletions.
27 changes: 27 additions & 0 deletions .chloggen/stanley.liu_datadog-agent-v0.52.0.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Use this changelog template to create an entry for release notes.

# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
change_type: bug_fix

# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver)
component: datadogexporter

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Stop dropping incoming OTel payloads when the processing channel is full and eliminate OOM issues in the trace agent and collector component in high load scenarios, making the OTel pipeline more reliable.

# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
issues: [31398]

# (Optional) One or more lines of additional information to render under the primary note.
# These lines will be padded with 2 spaces and then inserted directly into the document.
# Use pipe (|) for multiline entries.
subtext:

# If your change doesn't affect end users or the exported elements of any package,
# you should instead start your pull request title with [chore] or use the "Skip Changelog" label.
# Optional: The change log or logs in which this entry should be included.
# e.g. '[user]' or '[user, api]'
# Include 'user' if the change is relevant to end users.
# Include 'api' if there is a change to a library API.
# Default: '[user]'
change_logs: []
18 changes: 9 additions & 9 deletions cmd/configschema/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -216,17 +216,17 @@ require (
github.com/ClickHouse/ch-go v0.58.2 // indirect
github.com/ClickHouse/clickhouse-go/v2 v2.17.1 // indirect
github.com/DataDog/agent-payload/v5 v5.0.104 // indirect
github.com/DataDog/datadog-agent/pkg/obfuscate v0.50.2 // indirect
github.com/DataDog/datadog-agent/pkg/obfuscate v0.51.1-0.20240229172441-18b62a1f67d3 // indirect
github.com/DataDog/datadog-agent/pkg/proto v0.52.0-devel // indirect
github.com/DataDog/datadog-agent/pkg/remoteconfig/state v0.50.2 // indirect
github.com/DataDog/datadog-agent/pkg/trace v0.50.2 // indirect
github.com/DataDog/datadog-agent/pkg/util/cgroups v0.50.2 // indirect
github.com/DataDog/datadog-agent/pkg/util/log v0.50.2 // indirect
github.com/DataDog/datadog-agent/pkg/util/pointer v0.50.2 // indirect
github.com/DataDog/datadog-agent/pkg/util/scrubber v0.50.2 // indirect
github.com/DataDog/datadog-agent/pkg/remoteconfig/state v0.51.1-0.20240229172441-18b62a1f67d3 // indirect
github.com/DataDog/datadog-agent/pkg/trace v0.51.1-0.20240229172441-18b62a1f67d3 // indirect
github.com/DataDog/datadog-agent/pkg/util/cgroups v0.51.1-0.20240229172441-18b62a1f67d3 // indirect
github.com/DataDog/datadog-agent/pkg/util/log v0.51.1-0.20240229172441-18b62a1f67d3 // indirect
github.com/DataDog/datadog-agent/pkg/util/pointer v0.51.1-0.20240229172441-18b62a1f67d3 // indirect
github.com/DataDog/datadog-agent/pkg/util/scrubber v0.51.1-0.20240229172441-18b62a1f67d3 // indirect
github.com/DataDog/datadog-api-client-go/v2 v2.22.0 // indirect
github.com/DataDog/datadog-go/v5 v5.1.1 // indirect
github.com/DataDog/go-sqllexer v0.0.8 // indirect
github.com/DataDog/datadog-go/v5 v5.5.0 // indirect
github.com/DataDog/go-sqllexer v0.0.9 // indirect
github.com/DataDog/go-tuf v1.0.2-0.5.2 // indirect
github.com/DataDog/gohai v0.0.0-20230524154621-4316413895ee // indirect
github.com/DataDog/opentelemetry-mapping-go/pkg/inframetadata v0.13.4 // indirect
Expand Down
36 changes: 18 additions & 18 deletions cmd/configschema/go.sum

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

18 changes: 9 additions & 9 deletions cmd/otelcontribcol/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -264,17 +264,17 @@ require (
github.com/ClickHouse/ch-go v0.58.2 // indirect
github.com/ClickHouse/clickhouse-go/v2 v2.17.1 // indirect
github.com/DataDog/agent-payload/v5 v5.0.104 // indirect
github.com/DataDog/datadog-agent/pkg/obfuscate v0.50.2 // indirect
github.com/DataDog/datadog-agent/pkg/obfuscate v0.51.1-0.20240229172441-18b62a1f67d3 // indirect
github.com/DataDog/datadog-agent/pkg/proto v0.52.0-devel // indirect
github.com/DataDog/datadog-agent/pkg/remoteconfig/state v0.50.2 // indirect
github.com/DataDog/datadog-agent/pkg/trace v0.50.2 // indirect
github.com/DataDog/datadog-agent/pkg/util/cgroups v0.50.2 // indirect
github.com/DataDog/datadog-agent/pkg/util/log v0.50.2 // indirect
github.com/DataDog/datadog-agent/pkg/util/pointer v0.50.2 // indirect
github.com/DataDog/datadog-agent/pkg/util/scrubber v0.50.2 // indirect
github.com/DataDog/datadog-agent/pkg/remoteconfig/state v0.51.1-0.20240229172441-18b62a1f67d3 // indirect
github.com/DataDog/datadog-agent/pkg/trace v0.51.1-0.20240229172441-18b62a1f67d3 // indirect
github.com/DataDog/datadog-agent/pkg/util/cgroups v0.51.1-0.20240229172441-18b62a1f67d3 // indirect
github.com/DataDog/datadog-agent/pkg/util/log v0.51.1-0.20240229172441-18b62a1f67d3 // indirect
github.com/DataDog/datadog-agent/pkg/util/pointer v0.51.1-0.20240229172441-18b62a1f67d3 // indirect
github.com/DataDog/datadog-agent/pkg/util/scrubber v0.51.1-0.20240229172441-18b62a1f67d3 // indirect
github.com/DataDog/datadog-api-client-go/v2 v2.22.0 // indirect
github.com/DataDog/datadog-go/v5 v5.1.1 // indirect
github.com/DataDog/go-sqllexer v0.0.8 // indirect
github.com/DataDog/datadog-go/v5 v5.5.0 // indirect
github.com/DataDog/go-sqllexer v0.0.9 // indirect
github.com/DataDog/go-tuf v1.0.2-0.5.2 // indirect
github.com/DataDog/gohai v0.0.0-20230524154621-4316413895ee // indirect
github.com/DataDog/opentelemetry-mapping-go/pkg/inframetadata v0.13.4 // indirect
Expand Down
36 changes: 18 additions & 18 deletions cmd/otelcontribcol/go.sum

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

9 changes: 6 additions & 3 deletions connector/datadogconnector/connector.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import (

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"
"github.com/DataDog/datadog-go/v5/statsd"
"github.com/DataDog/opentelemetry-mapping-go/pkg/otlp/attributes"
"github.com/DataDog/opentelemetry-mapping-go/pkg/otlp/metrics"
"go.opentelemetry.io/collector/component"
Expand Down Expand Up @@ -45,7 +47,7 @@ type traceToMetricConnector struct {
var _ component.Component = (*traceToMetricConnector)(nil) // testing that the connectorImp properly implements the type Component interface

// function to create a new connector
func newTraceToMetricConnector(set component.TelemetrySettings, cfg component.Config, metricsConsumer consumer.Metrics) (*traceToMetricConnector, error) {
func newTraceToMetricConnector(set component.TelemetrySettings, cfg component.Config, metricsConsumer consumer.Metrics, metricsClient statsd.ClientInterface, timingReporter timing.Reporter) (*traceToMetricConnector, error) {
set.Logger.Info("Building datadog connector for traces to metrics")
in := make(chan *pb.StatsPayload, 100)
set.MeterProvider = noop.NewMeterProvider() // disable metrics for the connector
Expand All @@ -61,16 +63,17 @@ func newTraceToMetricConnector(set component.TelemetrySettings, cfg component.Co
ctx := context.Background()
return &traceToMetricConnector{
logger: set.Logger,
agent: datadog.NewAgentWithConfig(ctx, getTraceAgentCfg(cfg.(*Config).Traces), in),
agent: datadog.NewAgentWithConfig(ctx, getTraceAgentCfg(cfg.(*Config).Traces, attributesTranslator), in, metricsClient, timingReporter),
translator: trans,
in: in,
metricsConsumer: metricsConsumer,
exit: make(chan struct{}),
}, nil
}

func getTraceAgentCfg(cfg TracesConfig) *traceconfig.AgentConfig {
func getTraceAgentCfg(cfg TracesConfig, attributesTranslator *attributes.Translator) *traceconfig.AgentConfig {
acfg := traceconfig.New()
acfg.OTLPReceiver.AttributesTranslator = attributesTranslator
acfg.OTLPReceiver.SpanNameRemappings = cfg.SpanNameRemappings
acfg.OTLPReceiver.SpanNameAsResourceName = cfg.SpanNameAsResourceName
acfg.Ignore["resource"] = cfg.IgnoreResources
Expand Down
11 changes: 4 additions & 7 deletions connector/datadogconnector/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ package datadogconnector // import "github.com/open-telemetry/opentelemetry-coll
import (
"context"

"github.com/DataDog/datadog-agent/pkg/trace/timing"
"go.opentelemetry.io/collector/component"
"go.opentelemetry.io/collector/connector"
"go.opentelemetry.io/collector/consumer"
Expand Down Expand Up @@ -38,19 +39,15 @@ 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) {
initializeMetricsClient(params)
c, err := newTraceToMetricConnector(params.TelemetrySettings, cfg, nextConsumer)
metricsClient := datadog.InitializeMetricClient(params.MeterProvider)
timingReporter := timing.New(metricsClient)
c, err := newTraceToMetricConnector(params.TelemetrySettings, cfg, nextConsumer, metricsClient, timingReporter)
if err != nil {
return nil, err
}
return c, nil
}

func createTracesToTracesConnector(_ context.Context, params connector.CreateSettings, _ component.Config, nextConsumer consumer.Traces) (connector.Traces, error) {
initializeMetricsClient(params)
return newTraceToTraceConnector(params.Logger, nextConsumer), nil
}

func initializeMetricsClient(params connector.CreateSettings) {
datadog.InitializeMetricClient(params.MeterProvider)
}
Loading

0 comments on commit 47aa437

Please sign in to comment.