Skip to content

Commit

Permalink
[exporter/datadog] Respect confighttp in trace agent (#34025)
Browse files Browse the repository at this point in the history
Co-authored-by: Pablo Baeyens <pbaeyens31+github@gmail.com>
  • Loading branch information
songy23 and mx-psi committed Jul 11, 2024
1 parent b9a2c3f commit bcae858
Show file tree
Hide file tree
Showing 10 changed files with 53 additions and 12 deletions.
27 changes: 27 additions & 0 deletions .chloggen/ddexp-trace-http.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: enhancement

# 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: "Add a feature gate `exporter.datadogexporter.TraceExportUseCustomHTTPClient` that allows a custom HTTP client to be used in trace export"

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

# (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: "This is an experimental feature. By default the feature gate is disabled and trace export uses a default HTTP client."

# 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: []
2 changes: 1 addition & 1 deletion cmd/otelcontribcol/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ require (
github.com/DataDog/datadog-agent/pkg/remoteconfig/state v0.56.0-rc.1 // indirect
github.com/DataDog/datadog-agent/pkg/status/health v0.56.0-rc.1 // indirect
github.com/DataDog/datadog-agent/pkg/telemetry v0.56.0-rc.1 // indirect
github.com/DataDog/datadog-agent/pkg/trace v0.56.0-rc.1 // indirect
github.com/DataDog/datadog-agent/pkg/trace v0.56.0-rc.1.0.20240711082232-dc70454ece9f // indirect
github.com/DataDog/datadog-agent/pkg/util/backoff v0.56.0-rc.1 // indirect
github.com/DataDog/datadog-agent/pkg/util/cgroups v0.56.0-rc.1 // indirect
github.com/DataDog/datadog-agent/pkg/util/executable v0.56.0-rc.1 // indirect
Expand Down
4 changes: 2 additions & 2 deletions cmd/otelcontribcol/go.sum

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

2 changes: 1 addition & 1 deletion connector/datadogconnector/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ require (
github.com/DataDog/datadog-agent/comp/otelcol/otlp/components/metricsclient v0.56.0-rc.1
github.com/DataDog/datadog-agent/comp/otelcol/otlp/components/statsprocessor v0.56.0-rc.1
github.com/DataDog/datadog-agent/pkg/proto v0.56.0-rc.1
github.com/DataDog/datadog-agent/pkg/trace v0.56.0-rc.1
github.com/DataDog/datadog-agent/pkg/trace v0.56.0-rc.1.0.20240711082232-dc70454ece9f
github.com/DataDog/datadog-go/v5 v5.5.0
github.com/DataDog/opentelemetry-mapping-go/pkg/otlp/attributes v0.17.0
github.com/DataDog/opentelemetry-mapping-go/pkg/otlp/metrics v0.17.0
Expand Down
4 changes: 2 additions & 2 deletions connector/datadogconnector/go.sum

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

2 changes: 1 addition & 1 deletion exporter/datadogexporter/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ require (
github.com/DataDog/datadog-agent/pkg/logs/status/statusinterface v0.56.0-rc.1 // indirect
github.com/DataDog/datadog-agent/pkg/proto v0.56.0-rc.1
github.com/DataDog/datadog-agent/pkg/status/health v0.56.0-rc.1 // indirect
github.com/DataDog/datadog-agent/pkg/trace v0.56.0-rc.1
github.com/DataDog/datadog-agent/pkg/trace v0.56.0-rc.1.0.20240711082232-dc70454ece9f
github.com/DataDog/datadog-agent/pkg/util/startstop v0.56.0-rc.1 // indirect
github.com/DataDog/datadog-api-client-go/v2 v2.27.0
github.com/DataDog/datadog-go/v5 v5.5.0
Expand Down
4 changes: 2 additions & 2 deletions exporter/datadogexporter/go.sum

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

2 changes: 1 addition & 1 deletion exporter/datadogexporter/integrationtest/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ require (
github.com/DataDog/datadog-agent/pkg/remoteconfig/state v0.56.0-rc.1 // indirect
github.com/DataDog/datadog-agent/pkg/status/health v0.56.0-rc.1 // indirect
github.com/DataDog/datadog-agent/pkg/telemetry v0.56.0-rc.1 // indirect
github.com/DataDog/datadog-agent/pkg/trace v0.56.0-rc.1 // indirect
github.com/DataDog/datadog-agent/pkg/trace v0.56.0-rc.1.0.20240711082232-dc70454ece9f // indirect
github.com/DataDog/datadog-agent/pkg/util/backoff v0.56.0-rc.1 // indirect
github.com/DataDog/datadog-agent/pkg/util/cgroups v0.56.0-rc.1 // indirect
github.com/DataDog/datadog-agent/pkg/util/executable v0.56.0-rc.1 // indirect
Expand Down
4 changes: 2 additions & 2 deletions exporter/datadogexporter/integrationtest/go.sum

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

14 changes: 14 additions & 0 deletions exporter/datadogexporter/traces_exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"github.com/DataDog/opentelemetry-mapping-go/pkg/otlp/attributes/source"
"go.opentelemetry.io/collector/consumer"
"go.opentelemetry.io/collector/exporter"
"go.opentelemetry.io/collector/featuregate"
"go.opentelemetry.io/collector/pdata/pcommon"
"go.opentelemetry.io/collector/pdata/ptrace"
"go.uber.org/zap"
Expand All @@ -33,6 +34,13 @@ import (
"github.com/open-telemetry/opentelemetry-collector-contrib/exporter/datadogexporter/internal/scrub"
)

var traceCustomHTTPFeatureGate = featuregate.GlobalRegistry().MustRegister(
"exporter.datadogexporter.TraceExportUseCustomHTTPClient",
featuregate.StageAlpha,
featuregate.WithRegisterDescription("When enabled, trace export uses the HTTP client from the exporter HTTP configs"),
featuregate.WithRegisterFromVersion("v0.105.0"),
)

type traceExporter struct {
params exporter.Settings
cfg *Config
Expand Down Expand Up @@ -212,6 +220,12 @@ func newTraceAgentConfig(ctx context.Context, params exporter.Settings, cfg *Con
acfg.PeerTagsAggregation = cfg.Traces.PeerTagsAggregation
acfg.PeerTags = cfg.Traces.PeerTags
acfg.MaxSenderRetries = 4
if traceCustomHTTPFeatureGate.IsEnabled() {
params.Logger.Info("Experimental feature: datadog exporter trace export uses a custom HTTP client from the exporter HTTP configs")
acfg.HTTPClientFunc = func() *http.Client {
return clientutil.NewHTTPClient(cfg.ClientConfig)
}
}
if v := cfg.Traces.flushInterval; v > 0 {
acfg.TraceWriter.FlushPeriodSeconds = v
}
Expand Down

0 comments on commit bcae858

Please sign in to comment.