Skip to content

Commit

Permalink
Merge branch 'open-telemetry:main' into S3CLASS
Browse files Browse the repository at this point in the history
  • Loading branch information
pollosp authored Dec 10, 2024
2 parents 2a6da62 + adef54e commit bad8ac8
Show file tree
Hide file tree
Showing 14 changed files with 134 additions and 87 deletions.
27 changes: 27 additions & 0 deletions .chloggen/dd-conn-peer-tags.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: datadogconnector

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: "Flip configs `traces::compute_stats_by_span_kind`, `traces::peer_tags_aggregation` and `traces::peer_service_aggregation` to true by default"

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

# (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 enables Datadog APM stats on peer tags by default and is a backwards-compatible change. Read more on https://docs.datadoghq.com/tracing/guide/inferred-service-opt-in/."

# 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: []
27 changes: 27 additions & 0 deletions .chloggen/dd-exp-peer-tags.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: "Flip configs `traces::compute_stats_by_span_kind`, `traces::peer_tags_aggregation` and `traces::peer_service_aggregation` to true by default"

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

# (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 enables Datadog APM stats on peer tags by default and is a backwards-compatible change. Read more on https://docs.datadoghq.com/tracing/guide/inferred-service-opt-in/."

# 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: []
5 changes: 4 additions & 1 deletion connector/datadogconnector/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,10 @@ func createDefaultConfig() component.Config {
return &Config{
Traces: TracesConfig{
TracesConfig: datadogconfig.TracesConfig{
IgnoreResources: []string{},
IgnoreResources: []string{},
PeerServiceAggregation: true,
PeerTagsAggregation: true,
ComputeStatsBySpanKind: true,
},

TraceBuffer: 1000,
Expand Down
5 changes: 4 additions & 1 deletion connector/datadogconnector/factory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ func TestCreateDefaultConfig(t *testing.T) {
&Config{
Traces: TracesConfig{
TracesConfig: datadogconfig.TracesConfig{
IgnoreResources: []string{},
IgnoreResources: []string{},
PeerServiceAggregation: true,
PeerTagsAggregation: true,
ComputeStatsBySpanKind: true,
},
TraceBuffer: 1000,
BucketInterval: 10 * time.Second,
Expand Down
36 changes: 24 additions & 12 deletions exporter/datadogexporter/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -270,10 +270,14 @@ func (f *factory) createMetricsExporter(
statsv := set.BuildInfo.Command + set.BuildInfo.Version
f.consumeStatsPayload(ctx, &wg, statsIn, statsWriter, statsv, acfg.AgentVersion, set.Logger)
pcfg := newMetadataConfigfromConfig(cfg)
metadataReporter, err := f.Reporter(set, pcfg)
if err != nil {
cancel()
return nil, fmt.Errorf("failed to build host metadata reporter: %w", err)
// Don't start a `Reporter` if host metadata is disabled.
var metadataReporter *inframetadata.Reporter
if cfg.HostMetadata.Enabled {
metadataReporter, err = f.Reporter(set, pcfg)
if err != nil {
cancel()
return nil, fmt.Errorf("failed to build host metadata reporter: %w", err)
}
}

if cfg.OnlyMetadata {
Expand Down Expand Up @@ -375,10 +379,14 @@ func (f *factory) createTracesExporter(
}

pcfg := newMetadataConfigfromConfig(cfg)
metadataReporter, err := f.Reporter(set, pcfg)
if err != nil {
cancel()
return nil, fmt.Errorf("failed to build host metadata reporter: %w", err)
// Don't start a `Reporter` if host metadata is disabled.
var metadataReporter *inframetadata.Reporter
if cfg.HostMetadata.Enabled {
metadataReporter, err = f.Reporter(set, pcfg)
if err != nil {
cancel()
return nil, fmt.Errorf("failed to build host metadata reporter: %w", err)
}
}

if cfg.OnlyMetadata {
Expand Down Expand Up @@ -463,10 +471,14 @@ func (f *factory) createLogsExporter(
// cancel() runs on shutdown

pcfg := newMetadataConfigfromConfig(cfg)
metadataReporter, err := f.Reporter(set, pcfg)
if err != nil {
cancel()
return nil, fmt.Errorf("failed to build host metadata reporter: %w", err)
// Don't start a `Reporter` if host metadata is disabled.
var metadataReporter *inframetadata.Reporter
if cfg.HostMetadata.Enabled {
metadataReporter, err = f.Reporter(set, pcfg)
if err != nil {
cancel()
return nil, fmt.Errorf("failed to build host metadata reporter: %w", err)
}
}

attributesTranslator, err := f.AttributesTranslator(set.TelemetrySettings)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ processors:
connectors:
datadog/connector:
traces:
compute_stats_by_span_kind: true
peer_tags_aggregation: true
peer_tags: ["extra_peer_tag"]

exporters:
Expand Down
6 changes: 0 additions & 6 deletions exporter/datadogexporter/logs_exporter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -230,9 +230,6 @@ func TestLogsExporter(t *testing.T) {
Endpoint: server.URL,
},
},
HostMetadata: HostMetadataConfig{
ReporterPeriod: 30 * time.Minute,
},
}

params := exportertest.NewNopSettings()
Expand Down Expand Up @@ -598,9 +595,6 @@ func TestLogsAgentExporter(t *testing.T) {
CompressionLevel: 6,
BatchWait: 1,
},
HostMetadata: HostMetadataConfig{
ReporterPeriod: 30 * time.Minute,
},
}
params := exportertest.NewNopSettings()
f := NewFactory()
Expand Down
9 changes: 5 additions & 4 deletions exporter/datadogexporter/metrics_exporter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,13 @@ func TestNewExporter(t *testing.T) {
},
},
HostMetadata: HostMetadataConfig{
Enabled: true,
ReporterPeriod: 30 * time.Minute,
HostnameSource: HostnameSourceFirstResource,
},
}
cfg.HostMetadata.SetSourceTimeout(50 * time.Millisecond)

params := exportertest.NewNopSettings()
f := NewFactory()

Expand All @@ -76,8 +79,6 @@ func TestNewExporter(t *testing.T) {
require.NoError(t, err)
assert.Empty(t, server.MetadataChan)

cfg.HostMetadata.Enabled = true
cfg.HostMetadata.HostnameSource = HostnameSourceFirstResource
testMetrics = pmetric.NewMetrics()
testutil.TestMetrics.CopyTo(testMetrics)
err = exp.ConsumeMetrics(context.Background(), testMetrics)
Expand Down Expand Up @@ -440,7 +441,9 @@ func TestNewExporter_Zorkian(t *testing.T) {
},
},
HostMetadata: HostMetadataConfig{
Enabled: true,
ReporterPeriod: 30 * time.Minute,
HostnameSource: HostnameSourceFirstResource,
},
}
params := exportertest.NewNopSettings()
Expand All @@ -456,8 +459,6 @@ func TestNewExporter_Zorkian(t *testing.T) {
require.NoError(t, err)
assert.Empty(t, server.MetadataChan)

cfg.HostMetadata.Enabled = true
cfg.HostMetadata.HostnameSource = HostnameSourceFirstResource
testMetrics = pmetric.NewMetrics()
testutil.TestMetrics.CopyTo(testMetrics)
err = exp.ConsumeMetrics(context.Background(), testMetrics)
Expand Down
15 changes: 1 addition & 14 deletions exporter/datadogexporter/traces_exporter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,6 @@ func TestTracesSource(t *testing.T) {
IgnoreResources: []string{},
},
},
HostMetadata: HostMetadataConfig{
ReporterPeriod: 30 * time.Minute,
},
}

assert := assert.New(t)
Expand Down Expand Up @@ -270,9 +267,6 @@ func TestTraceExporter(t *testing.T) {
},
TraceBuffer: 2,
},
HostMetadata: HostMetadataConfig{
ReporterPeriod: 30 * time.Minute,
},
}
cfg.Traces.SetFlushInterval(0.1)

Expand All @@ -298,11 +292,7 @@ func TestNewTracesExporter(t *testing.T) {
metricsServer := testutil.DatadogServerMock()
defer metricsServer.Close()

cfg := &Config{
HostMetadata: HostMetadataConfig{
ReporterPeriod: 30 * time.Minute,
},
}
cfg := &Config{}
cfg.API.Key = "ddog_32_characters_long_api_key1"
cfg.Metrics.TCPAddrConfig.Endpoint = metricsServer.URL
params := exportertest.NewNopSettings()
Expand Down Expand Up @@ -368,9 +358,6 @@ func TestPushTraceData_NewEnvConvention(t *testing.T) {
Traces: TracesConfig{
TCPAddrConfig: confignet.TCPAddrConfig{Endpoint: server.URL},
},
HostMetadata: HostMetadataConfig{
ReporterPeriod: 30 * time.Minute,
},
}
cfg.Traces.SetFlushInterval(0.1)

Expand Down
5 changes: 4 additions & 1 deletion pkg/datadog/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,10 @@ func CreateDefaultConfig() component.Config {
Endpoint: "https://trace.agent.datadoghq.com",
},
TracesConfig: TracesConfig{
IgnoreResources: []string{},
IgnoreResources: []string{},
PeerServiceAggregation: true,
PeerTagsAggregation: true,
ComputeStatsBySpanKind: true,
},
},

Expand Down
23 changes: 19 additions & 4 deletions pkg/datadog/config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,10 @@ func TestCreateDefaultConfig(t *testing.T) {
Endpoint: "https://trace.agent.datadoghq.com",
},
TracesConfig: TracesConfig{
IgnoreResources: []string{},
IgnoreResources: []string{},
PeerServiceAggregation: true,
PeerTagsAggregation: true,
ComputeStatsBySpanKind: true,
},
},
Logs: LogsConfig{
Expand Down Expand Up @@ -510,7 +513,10 @@ func TestLoadConfig(t *testing.T) {
Endpoint: "https://trace.agent.datadoghq.com",
},
TracesConfig: TracesConfig{
IgnoreResources: []string{},
IgnoreResources: []string{},
PeerServiceAggregation: true,
PeerTagsAggregation: true,
ComputeStatsBySpanKind: true,
},
},
Logs: LogsConfig{
Expand Down Expand Up @@ -571,6 +577,9 @@ func TestLoadConfig(t *testing.T) {
},
SpanNameAsResourceName: true,
IgnoreResources: []string{},
PeerServiceAggregation: true,
PeerTagsAggregation: true,
ComputeStatsBySpanKind: true,
},
TraceBuffer: 10,
},
Expand Down Expand Up @@ -630,7 +639,10 @@ func TestLoadConfig(t *testing.T) {
"old_name3": "new_name3",
"old_name4": "new_name4",
},
IgnoreResources: []string{},
IgnoreResources: []string{},
PeerServiceAggregation: true,
PeerTagsAggregation: true,
ComputeStatsBySpanKind: true,
},
},
Logs: LogsConfig{
Expand Down Expand Up @@ -684,7 +696,10 @@ func TestLoadConfig(t *testing.T) {
Endpoint: "https://trace.agent.datadoghq.com",
},
TracesConfig: TracesConfig{
IgnoreResources: []string{},
IgnoreResources: []string{},
ComputeStatsBySpanKind: true,
PeerServiceAggregation: true,
PeerTagsAggregation: true,
},
},
Logs: LogsConfig{
Expand Down
2 changes: 1 addition & 1 deletion pkg/datadog/config/config_warnings_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ func TestPeerTags(t *testing.T) {
{
name: "traces::peer_service_aggregation and traces::peer_tags_aggregation unset",
cfgMap: confmap.New(),
expectedPeerTagsValue: false,
expectedPeerTagsValue: true,
},
{
name: "traces::peer_tags_aggregation set",
Expand Down
17 changes: 6 additions & 11 deletions receiver/awscontainerinsightreceiver/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.22.0

require (
github.com/aws/aws-sdk-go v1.55.5
github.com/google/cadvisor v0.49.1-0.20240628164550-89f779d86055
github.com/google/cadvisor v0.51.0
github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/awsutil v0.115.0
github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/containerinsight v0.115.0
github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/k8s v0.115.0
Expand Down Expand Up @@ -35,10 +35,11 @@ require (
github.com/Microsoft/go-winio v0.6.2 // indirect
github.com/blang/semver/v4 v4.0.0 // indirect
github.com/cenkalti/backoff/v4 v4.3.0 // indirect
github.com/checkpoint-restore/go-criu/v5 v5.3.0 // indirect
github.com/cilium/ebpf v0.7.0 // indirect
github.com/containerd/console v1.0.3 // indirect
github.com/containerd/ttrpc v1.2.4 // indirect
github.com/containerd/containerd/api v1.7.19 // indirect
github.com/containerd/errdefs v0.1.0 // indirect
github.com/containerd/log v0.1.0 // indirect
github.com/containerd/ttrpc v1.2.5 // indirect
github.com/coreos/go-systemd/v22 v22.3.2 // indirect
github.com/cyphar/filepath-securejoin v0.2.4 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
Expand Down Expand Up @@ -87,14 +88,12 @@ require (
github.com/moby/sys/mountinfo v0.7.1 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/mrunalp/fileutils v0.5.1 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/open-telemetry/opentelemetry-collector-contrib/internal/common v0.115.0 // indirect
github.com/opencontainers/go-digest v1.0.0 // indirect
github.com/opencontainers/image-spec v1.0.2 // indirect
github.com/opencontainers/image-spec v1.1.0 // indirect
github.com/opencontainers/runc v1.1.14 // indirect
github.com/opencontainers/runtime-spec v1.2.0 // indirect
github.com/opencontainers/selinux v1.10.0 // indirect
github.com/openshift/api v3.9.0+incompatible // indirect
github.com/openshift/client-go v0.0.0-20210521082421-73d9475a9142 // indirect
github.com/pierrec/lz4/v4 v4.1.21 // indirect
Expand All @@ -104,15 +103,11 @@ require (
github.com/prometheus/client_model v0.6.1 // indirect
github.com/prometheus/common v0.59.1 // indirect
github.com/rs/cors v1.11.1 // indirect
github.com/seccomp/libseccomp-golang v0.9.2-0.20220502022130-f33da4d89646 // indirect
github.com/sirupsen/logrus v1.9.3 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/stretchr/objx v0.5.2 // indirect
github.com/syndtr/gocapability v0.0.0-20200815063812-42c35b437635 // indirect
github.com/tklauser/go-sysconf v0.3.12 // indirect
github.com/tklauser/numcpus v0.6.1 // indirect
github.com/vishvananda/netlink v1.1.1-0.20201029203352-d40f9887b852 // indirect
github.com/vishvananda/netns v0.0.0-20200728191858-db3c7e526aae // indirect
github.com/x448/float16 v0.8.4 // indirect
github.com/yusufpapurcu/wmi v1.2.4 // indirect
go.opentelemetry.io/collector/client v1.21.1-0.20241206185113-3f3e208e71b8 // indirect
Expand Down
Loading

0 comments on commit bad8ac8

Please sign in to comment.