Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[exporter/datadog] Send host metadata on change, refactor main host metadata sending #25145

Merged
merged 10 commits into from
Sep 5, 2023
28 changes: 28 additions & 0 deletions .chloggen/mx-psi_inframetadata-base-reporter.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# 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: Host metadata for remote hosts is now reported on first sight or on change

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

# (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: |
Host metadata for remote hosts will only be sent for payloads with the datadog.host.use_as_metadata resource attribute.

# 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: [user]
10 changes: 5 additions & 5 deletions cmd/configschema/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ require (
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor v0.8.0 // indirect
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1.0.0 // indirect
github.com/AzureAD/microsoft-authentication-library-for-go v1.0.0 // indirect
github.com/DataDog/opentelemetry-mapping-go/pkg/otlp/attributes v0.7.0 // indirect
github.com/DataDog/opentelemetry-mapping-go/pkg/otlp/metrics v0.7.0 // indirect
github.com/DataDog/opentelemetry-mapping-go/pkg/otlp/attributes v0.7.1 // indirect
github.com/DataDog/opentelemetry-mapping-go/pkg/otlp/metrics v0.7.1 // indirect
github.com/gocql/gocql v1.3.1 // indirect
github.com/hailocab/go-hostpool v0.0.0-20160125115350-e80d13ce29ed // indirect
github.com/open-telemetry/opentelemetry-collector-contrib/exporter/alibabacloudlogserviceexporter v0.82.0 // indirect
Expand Down Expand Up @@ -246,9 +246,9 @@ require (
github.com/DataDog/datadog-go/v5 v5.1.1 // indirect
github.com/DataDog/go-tuf v1.0.1-0.5.2 // indirect
github.com/DataDog/gohai v0.0.0-20220718130825-1776f9beb9cc // indirect
github.com/DataDog/opentelemetry-mapping-go/pkg/inframetadata v0.7.0 // indirect
github.com/DataDog/opentelemetry-mapping-go/pkg/otlp/logs v0.7.0 // indirect
github.com/DataDog/opentelemetry-mapping-go/pkg/quantile v0.7.0 // indirect
github.com/DataDog/opentelemetry-mapping-go/pkg/inframetadata v0.7.1 // indirect
github.com/DataDog/opentelemetry-mapping-go/pkg/otlp/logs v0.7.1 // indirect
github.com/DataDog/opentelemetry-mapping-go/pkg/quantile v0.7.1 // indirect
github.com/DataDog/sketches-go v1.4.2 // indirect
github.com/DataDog/zstd v1.5.2 // indirect
github.com/GehirnInc/crypt v0.0.0-20200316065508-bb7000b8a962 // indirect
Expand Down
22 changes: 11 additions & 11 deletions cmd/configschema/go.sum

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

10 changes: 5 additions & 5 deletions cmd/otelcontribcol/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -265,11 +265,11 @@ require (
github.com/DataDog/datadog-go/v5 v5.1.1 // indirect
github.com/DataDog/go-tuf v1.0.1-0.5.2 // indirect
github.com/DataDog/gohai v0.0.0-20220718130825-1776f9beb9cc // indirect
github.com/DataDog/opentelemetry-mapping-go/pkg/inframetadata v0.7.0 // indirect
github.com/DataDog/opentelemetry-mapping-go/pkg/otlp/attributes v0.7.0 // indirect
github.com/DataDog/opentelemetry-mapping-go/pkg/otlp/logs v0.7.0 // indirect
github.com/DataDog/opentelemetry-mapping-go/pkg/otlp/metrics v0.7.0 // indirect
github.com/DataDog/opentelemetry-mapping-go/pkg/quantile v0.7.0 // indirect
github.com/DataDog/opentelemetry-mapping-go/pkg/inframetadata v0.7.1 // indirect
github.com/DataDog/opentelemetry-mapping-go/pkg/otlp/attributes v0.7.1 // indirect
github.com/DataDog/opentelemetry-mapping-go/pkg/otlp/logs v0.7.1 // indirect
github.com/DataDog/opentelemetry-mapping-go/pkg/otlp/metrics v0.7.1 // indirect
github.com/DataDog/opentelemetry-mapping-go/pkg/quantile v0.7.1 // indirect
github.com/DataDog/sketches-go v1.4.2 // indirect
github.com/DataDog/zstd v1.5.2 // indirect
github.com/GehirnInc/crypt v0.0.0-20200316065508-bb7000b8a962 // indirect
Expand Down
22 changes: 11 additions & 11 deletions cmd/otelcontribcol/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 connector/datadogconnector/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.19

require (
github.com/DataDog/datadog-agent/pkg/proto v0.48.0-beta.1
github.com/DataDog/opentelemetry-mapping-go/pkg/otlp/metrics v0.7.0
github.com/DataDog/opentelemetry-mapping-go/pkg/otlp/metrics v0.7.1
github.com/open-telemetry/opentelemetry-collector-contrib/internal/datadog v0.82.0
github.com/stretchr/testify v1.8.4
go.opentelemetry.io/collector/component v0.82.0
Expand All @@ -24,8 +24,8 @@ require (
github.com/DataDog/datadog-agent/pkg/util/scrubber v0.48.0-beta.1 // indirect
github.com/DataDog/datadog-go/v5 v5.1.1 // indirect
github.com/DataDog/go-tuf v1.0.1-0.5.2 // indirect
github.com/DataDog/opentelemetry-mapping-go/pkg/otlp/attributes v0.7.0 // indirect
github.com/DataDog/opentelemetry-mapping-go/pkg/quantile v0.7.0 // indirect
github.com/DataDog/opentelemetry-mapping-go/pkg/otlp/attributes v0.7.1 // indirect
github.com/DataDog/opentelemetry-mapping-go/pkg/quantile v0.7.1 // indirect
github.com/DataDog/sketches-go v1.4.2 // indirect
github.com/Microsoft/go-winio v0.6.1 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
Expand Down
14 changes: 7 additions & 7 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 @@ -246,7 +246,7 @@ func (f *factory) createMetricsExporter(
if md.ResourceMetrics().Len() > 0 {
attrs = md.ResourceMetrics().At(0).Resource().Attributes()
}
go hostmetadata.RunPusher(ctx, set, pcfg, hostProvider, attrs)
go hostmetadata.RunPusher(ctx, set, pcfg, hostProvider, attrs, metadataReporter)
})

// Consume resources for host metadata
Expand Down Expand Up @@ -331,7 +331,7 @@ func (f *factory) createTracesExporter(
if td.ResourceSpans().Len() > 0 {
attrs = td.ResourceSpans().At(0).Resource().Attributes()
}
go hostmetadata.RunPusher(ctx, set, pcfg, hostProvider, attrs)
go hostmetadata.RunPusher(ctx, set, pcfg, hostProvider, attrs, metadataReporter)
})
// Consume resources for host metadata
for i := 0; i < td.ResourceSpans().Len(); i++ {
Expand Down Expand Up @@ -402,7 +402,7 @@ func (f *factory) createLogsExporter(
pusher = func(_ context.Context, td plog.Logs) error {
f.onceMetadata.Do(func() {
attrs := pcommon.NewMap()
go hostmetadata.RunPusher(ctx, set, pcfg, hostProvider, attrs)
go hostmetadata.RunPusher(ctx, set, pcfg, hostProvider, attrs, metadataReporter)
})
for i := 0; i < td.ResourceLogs().Len(); i++ {
res := td.ResourceLogs().At(i).Resource()
Expand Down
10 changes: 5 additions & 5 deletions exporter/datadogexporter/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ require (
github.com/DataDog/datadog-agent/pkg/trace v0.48.0-beta.1
github.com/DataDog/datadog-api-client-go/v2 v2.14.0
github.com/DataDog/gohai v0.0.0-20220718130825-1776f9beb9cc
github.com/DataDog/opentelemetry-mapping-go/pkg/inframetadata v0.7.0
github.com/DataDog/opentelemetry-mapping-go/pkg/otlp/attributes v0.7.0
github.com/DataDog/opentelemetry-mapping-go/pkg/otlp/logs v0.7.0
github.com/DataDog/opentelemetry-mapping-go/pkg/otlp/metrics v0.7.0
github.com/DataDog/opentelemetry-mapping-go/pkg/quantile v0.7.0
github.com/DataDog/opentelemetry-mapping-go/pkg/inframetadata v0.7.1
github.com/DataDog/opentelemetry-mapping-go/pkg/otlp/attributes v0.7.1
github.com/DataDog/opentelemetry-mapping-go/pkg/otlp/logs v0.7.1
github.com/DataDog/opentelemetry-mapping-go/pkg/otlp/metrics v0.7.1
github.com/DataDog/opentelemetry-mapping-go/pkg/quantile v0.7.1
github.com/DataDog/sketches-go v1.4.2
github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp v1.18.0
github.com/aws/aws-sdk-go v1.44.319
Expand Down
22 changes: 11 additions & 11 deletions exporter/datadogexporter/go.sum

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

Loading