Skip to content

Commit 29114b2

Browse files
committed
Merge branch 'main' into aiuto/curl
2 parents 2f9e8f2 + 5465ff9 commit 29114b2

File tree

30 files changed

+360
-80
lines changed

30 files changed

+360
-80
lines changed

.gitlab/integration_test/otel.yml

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -43,27 +43,28 @@ docker_image_build_otel:
4343
- !reference [.except_mergequeue]
4444
- when: on_success
4545

46-
datadog_otel_components_ocb_build:
47-
stage: integration_test
48-
image: registry.ddbuild.io/ci/datadog-agent-buildimages/linux$CI_IMAGE_LINUX_SUFFIX:$CI_IMAGE_LINUX
49-
tags: ["arch:amd64", "specific:true"]
50-
needs: ["go_deps"]
51-
artifacts:
52-
paths:
53-
- ocb-output.log
54-
- otelcol-custom.log
55-
- flare-info.log
56-
when: always
57-
before_script:
58-
- !reference [.retrieve_linux_go_deps]
59-
script:
60-
- echo "Building custom collector with datadog components"
61-
- test/otel/testdata/ocb_build_script.sh
62-
- echo "see artifacts for job logs"
63-
rules:
64-
- !reference [.except_mergequeue]
65-
- when: on_success
66-
timeout: 15 minutes
46+
# TODO(songy23): re-enable datadog_otel_components_ocb_build after OSS DD exporter adopts https://github.com/DataDog/datadog-agent/pull/42542
47+
# datadog_otel_components_ocb_build:
48+
# stage: integration_test
49+
# image: registry.ddbuild.io/ci/datadog-agent-buildimages/linux$CI_IMAGE_LINUX_SUFFIX:$CI_IMAGE_LINUX
50+
# tags: ["arch:amd64", "specific:true"]
51+
# needs: ["go_deps"]
52+
# artifacts:
53+
# paths:
54+
# - ocb-output.log
55+
# - otelcol-custom.log
56+
# - flare-info.log
57+
# when: always
58+
# before_script:
59+
# - !reference [.retrieve_linux_go_deps]
60+
# script:
61+
# - echo "Building custom collector with datadog components"
62+
# - test/otel/testdata/ocb_build_script.sh
63+
# - echo "see artifacts for job logs"
64+
# rules:
65+
# - !reference [.except_mergequeue]
66+
# - when: on_success
67+
# timeout: 15 minutes
6768

6869
# Test that the BYOC packages can be built with the existing Dockerfile
6970
ddot_byoc_package_build_test_rpm:

cmd/agent/subcommands/snmp/command.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,9 @@ func scanDevice(connParams *snmpparse.SNMPConfig, args argsType, snmpScanner snm
287287
deviceID := namespace + ":" + connParams.IPAddress
288288
// Start the scan
289289
fmt.Printf("Launching scan for device: %s\n", deviceID)
290-
err := snmpScanner.ScanDeviceAndSendData(connParams, namespace, metadata.ManualScan)
290+
err := snmpScanner.ScanDeviceAndSendData(connParams, namespace, snmpscan.ScanParams{
291+
ScanType: metadata.ManualScan,
292+
})
291293
if err != nil {
292294
fmt.Printf("Unable to perform device scan for device %s : %e", deviceID, err)
293295
}

comp/core/agenttelemetry/impl/config.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -602,7 +602,7 @@ func parseConfig(cfg config.Component) (*Config, error) {
602602
atCfgMap := cfg.GetStringMap("agent_telemetry")
603603
if len(atCfgMap) > 0 {
604604
// Reconvert to string and back to object.
605-
// Config.UnmarshalKey() is better but it did not work in some cases
605+
// structure.UnmarshalKey() is better but it did not work in some cases
606606
atCfgBytes, err := yaml.Marshal(atCfgMap)
607607
if err != nil {
608608
return nil, err

comp/core/workloadfilter/catalog/filter_config.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import (
1414
"github.com/DataDog/datadog-agent/comp/core/config"
1515
workloadfilter "github.com/DataDog/datadog-agent/comp/core/workloadfilter/def"
1616
"github.com/DataDog/datadog-agent/comp/core/workloadfilter/impl/parse"
17+
"github.com/DataDog/datadog-agent/pkg/config/structure"
1718
)
1819

1920
// FilterConfig holds all configuration values needed for filter initialization
@@ -127,7 +128,7 @@ func loadCELConfig(cfg config.Component) ([]workloadfilter.RuleBundle, error) {
127128
var celConfig []workloadfilter.RuleBundle
128129

129130
// First try the standard UnmarshalKey method (input defined in datadog.yaml)
130-
err := cfg.UnmarshalKey("cel_workload_exclude", &celConfig)
131+
err := structure.UnmarshalKey(cfg, "cel_workload_exclude", &celConfig)
131132
if err == nil {
132133
return celConfig, nil
133134
}

comp/core/workloadfilter/catalog/filter_config_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ func TestNewFilterConfig_CELFallback(t *testing.T) {
2323
mockConfig := configmock.New(t)
2424

2525
// Set up valid CEL config that should unmarshal successfully
26-
celConfig := []workloadfilter.RuleBundle{
26+
celConfig := []map[string]interface{}{
2727
{
28-
Products: []workloadfilter.Product{workloadfilter.ProductMetrics},
29-
Rules: map[workloadfilter.ResourceType][]string{
30-
workloadfilter.ContainerType: {"container.name == 'test'"},
28+
"products": []string{"metrics"},
29+
"rules": map[string][]string{
30+
"container": {"container.name == 'test'"},
3131
},
3232
},
3333
}

comp/core/workloadfilter/impl/parse/parse_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import (
1212
"github.com/stretchr/testify/require"
1313

1414
configcomp "github.com/DataDog/datadog-agent/comp/core/config"
15+
"github.com/DataDog/datadog-agent/pkg/config/structure"
1516

1617
workloadfilter "github.com/DataDog/datadog-agent/comp/core/workloadfilter/def"
1718
)
@@ -129,7 +130,7 @@ cel_workload_exclude:
129130
`
130131
configComponent := configcomp.NewMockFromYAML(t, yamlConfig)
131132
var filterConfig []workloadfilter.RuleBundle
132-
err := configComponent.UnmarshalKey("cel_workload_exclude", &filterConfig)
133+
err := structure.UnmarshalKey(configComponent, "cel_workload_exclude", &filterConfig)
133134

134135
require.NoError(t, err)
135136
assert.Len(t, filterConfig, 2)

comp/networkpath/npcollector/npcollectorimpl/config.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import (
1212
log "github.com/DataDog/datadog-agent/comp/core/log/def"
1313
"github.com/DataDog/datadog-agent/comp/networkpath/npcollector/npcollectorimpl/connfilter"
1414
"github.com/DataDog/datadog-agent/comp/networkpath/npcollector/npcollectorimpl/pathteststore"
15+
"github.com/DataDog/datadog-agent/pkg/config/structure"
1516
"github.com/DataDog/datadog-agent/pkg/networkpath/payload"
1617
)
1718

@@ -43,7 +44,7 @@ type collectorConfigs struct {
4344

4445
func newConfig(agentConfig config.Component, logger log.Component) *collectorConfigs {
4546
var filterConfigs []connfilter.Config
46-
err := agentConfig.UnmarshalKey("network_path.collector.filters", &filterConfigs)
47+
err := structure.UnmarshalKey(agentConfig, "network_path.collector.filters", &filterConfigs)
4748
if err != nil {
4849
logger.Errorf("Error unmarshalling network_path.collector.filters")
4950
filterConfigs = nil

comp/otelcol/ddprofilingextension/impl/extension_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ func (c testComponent) SetOTelAttributeTranslator(attrstrans *otlpattributes.Tra
4141
c.Agent.OTLPReceiver.SetOTelAttributeTranslator(attrstrans)
4242
}
4343

44-
func (c testComponent) ReceiveOTLPSpans(ctx context.Context, rspans ptrace.ResourceSpans, httpHeader http.Header, hostFromAttributesHandler otlpattributes.HostFromAttributesHandler) otlpsource.Source {
44+
func (c testComponent) ReceiveOTLPSpans(ctx context.Context, rspans ptrace.ResourceSpans, httpHeader http.Header, hostFromAttributesHandler otlpattributes.HostFromAttributesHandler) (otlpsource.Source, error) {
4545
return c.Agent.OTLPReceiver.ReceiveResourceSpans(ctx, rspans, httpHeader, hostFromAttributesHandler)
4646
}
4747

comp/otelcol/otlp/components/exporter/datadogexporter/host_metadata_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ func createTestFactory(t *testing.T, serverAddr string) exporter.Factory {
155155
traceagent := pkgagent.NewAgent(ctx, tcfg, telemetry.NewNoopCollector(), &ddgostatsd.NoOpClient{}, implgzip.NewComponent())
156156
go traceagent.Run()
157157

158-
return NewFactory(testComponent{traceagent}, srlz, &mockLogsAgentPipeline{}, sourceProvider, metricsclient.NewStatsdClientWrapper(&ddgostatsd.NoOpClient{}), otel.NewDisabledGatewayUsage(), serializerexporter.TelemetryStore{})
158+
return NewFactory(testComponent{traceagent, nil}, srlz, &mockLogsAgentPipeline{}, sourceProvider, metricsclient.NewStatsdClientWrapper(&ddgostatsd.NoOpClient{}), otel.NewDisabledGatewayUsage(), serializerexporter.TelemetryStore{})
159159
}
160160

161161
func TestHostMetadata_FromTraces(t *testing.T) {

comp/otelcol/otlp/components/exporter/datadogexporter/traces_exporter.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,10 @@ func (exp *traceExporter) consumeTraces(
7676
exp.params.Logger.Warn("failed to consume resource for host metadata", zap.Error(err), zap.Any("resource", res))
7777
}
7878
}
79-
src := exp.traceagentcmp.ReceiveOTLPSpans(ctx, rspan, header, exp.gatewayUsage.GetHostFromAttributesHandler())
79+
src, err := exp.traceagentcmp.ReceiveOTLPSpans(ctx, rspan, header, exp.gatewayUsage.GetHostFromAttributesHandler())
80+
if err != nil {
81+
return err
82+
}
8083
switch src.Kind {
8184
case source.HostnameKind:
8285
hosts[src.Identifier] = struct{}{}

0 commit comments

Comments
 (0)