Skip to content

Commit feee241

Browse files
liustanleyf7o
authored andcommitted
[exporter/datadog] Use correct hostname for logs in logs agent pipeline (open-telemetry#35058)
**Description:** <Describe what has changed.> <!--Ex. Fixing a bug - Describe the bug and how this fixes the issue. Ex. Adding a feature - Explain what this achieves.--> Includes bug fix from DataDog/datadog-agent#28870. In gateway deployments using the logs agent feature gate, some logs may be associated with the hostname of the gateway collector instead of the host sending the logs. This fixes this issue by explicitly assigning the mapped log hostname. **Link to tracking Issue:** <Issue number if applicable> **Testing:** <Describe what testing was performed and which tests were added.> Performed manual tests and added unit test. **Documentation:** <Describe the documentation added.>
1 parent 0fbbad7 commit feee241

File tree

10 files changed

+54
-24
lines changed

10 files changed

+54
-24
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Use this changelog template to create an entry for release notes.
2+
3+
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
4+
change_type: bug_fix
5+
6+
# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver)
7+
component: datadogexporter
8+
9+
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
10+
note: Use correct hostname for logs when using Datadog Agent logs pipeline with a gateway deployment.
11+
12+
# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
13+
issues: [35058]
14+
15+
# (Optional) One or more lines of additional information to render under the primary note.
16+
# These lines will be padded with 2 spaces and then inserted directly into the document.
17+
# Use pipe (|) for multiline entries.
18+
subtext:
19+
20+
# If your change doesn't affect end users or the exported elements of any package,
21+
# you should instead start your pull request title with [chore] or use the "Skip Changelog" label.
22+
# Optional: The change log or logs in which this entry should be included.
23+
# e.g. '[user]' or '[user, api]'
24+
# Include 'user' if the change is relevant to end users.
25+
# Include 'api' if there is a change to a library API.
26+
# Default: '[user]'
27+
change_logs: []

cmd/otelcontribcol/go.mod

+2-2
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ require (
304304
github.com/DataDog/datadog-agent/comp/logs/agent/config v0.56.2 // indirect
305305
github.com/DataDog/datadog-agent/comp/otelcol/logsagentpipeline v0.56.2 // indirect
306306
github.com/DataDog/datadog-agent/comp/otelcol/logsagentpipeline/logsagentpipelineimpl v0.56.2 // indirect
307-
github.com/DataDog/datadog-agent/comp/otelcol/otlp/components/exporter/logsagentexporter v0.56.2 // indirect
307+
github.com/DataDog/datadog-agent/comp/otelcol/otlp/components/exporter/logsagentexporter v0.58.0-devel.0.20240905201012-b02662b2ba27 // indirect
308308
github.com/DataDog/datadog-agent/comp/otelcol/otlp/components/metricsclient v0.56.2 // indirect
309309
github.com/DataDog/datadog-agent/comp/otelcol/otlp/components/statsprocessor v0.56.2 // indirect
310310
github.com/DataDog/datadog-agent/comp/trace/compression/def v0.56.2 // indirect
@@ -830,7 +830,7 @@ require (
830830
go.uber.org/multierr v1.11.0 // indirect
831831
go.uber.org/zap v1.27.0 // indirect
832832
golang.org/x/crypto v0.26.0 // indirect
833-
golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842 // indirect
833+
golang.org/x/exp v0.0.0-20240808152545-0cdaa3abc0fa // indirect
834834
golang.org/x/mod v0.20.0 // indirect
835835
golang.org/x/net v0.28.0 // indirect
836836
golang.org/x/oauth2 v0.22.0 // indirect

cmd/otelcontribcol/go.sum

+4-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

connector/datadogconnector/go.mod

+2-2
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ require (
5050
github.com/DataDog/datadog-agent/comp/logs/agent/config v0.56.2 // indirect
5151
github.com/DataDog/datadog-agent/comp/otelcol/logsagentpipeline v0.56.2 // indirect
5252
github.com/DataDog/datadog-agent/comp/otelcol/logsagentpipeline/logsagentpipelineimpl v0.56.2 // indirect
53-
github.com/DataDog/datadog-agent/comp/otelcol/otlp/components/exporter/logsagentexporter v0.56.2 // indirect
53+
github.com/DataDog/datadog-agent/comp/otelcol/otlp/components/exporter/logsagentexporter v0.58.0-devel.0.20240905201012-b02662b2ba27 // indirect
5454
github.com/DataDog/datadog-agent/comp/trace/compression/def v0.56.2 // indirect
5555
github.com/DataDog/datadog-agent/comp/trace/compression/impl-gzip v0.56.2 // indirect
5656
github.com/DataDog/datadog-agent/pkg/collector/check/defaults v0.56.2 // indirect
@@ -271,7 +271,7 @@ require (
271271
go.uber.org/dig v1.17.1 // indirect
272272
go.uber.org/fx v1.18.2 // indirect
273273
go.uber.org/multierr v1.11.0 // indirect
274-
golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842 // indirect
274+
golang.org/x/exp v0.0.0-20240808152545-0cdaa3abc0fa // indirect
275275
golang.org/x/net v0.28.0 // indirect
276276
golang.org/x/oauth2 v0.22.0 // indirect
277277
golang.org/x/sys v0.24.0 // indirect

connector/datadogconnector/go.sum

+4-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

exporter/datadogexporter/go.mod

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ require (
1010
github.com/DataDog/datadog-agent/comp/logs/agent/config v0.56.2
1111
github.com/DataDog/datadog-agent/comp/otelcol/logsagentpipeline v0.56.2
1212
github.com/DataDog/datadog-agent/comp/otelcol/logsagentpipeline/logsagentpipelineimpl v0.56.2
13-
github.com/DataDog/datadog-agent/comp/otelcol/otlp/components/exporter/logsagentexporter v0.56.2
13+
github.com/DataDog/datadog-agent/comp/otelcol/otlp/components/exporter/logsagentexporter v0.58.0-devel.0.20240905201012-b02662b2ba27
1414
github.com/DataDog/datadog-agent/comp/otelcol/otlp/components/metricsclient v0.56.2
1515
github.com/DataDog/datadog-agent/comp/otelcol/otlp/testutil v0.57.0-devel.0.20240718200853-81bf3b2e412d
1616
github.com/DataDog/datadog-agent/comp/trace/compression/impl-gzip v0.56.2
@@ -362,7 +362,7 @@ require (
362362
go.uber.org/fx v1.18.2 // indirect
363363
go.uber.org/multierr v1.11.0 // indirect
364364
golang.org/x/crypto v0.26.0 // indirect
365-
golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842 // indirect
365+
golang.org/x/exp v0.0.0-20240808152545-0cdaa3abc0fa // indirect
366366
golang.org/x/mod v0.20.0 // indirect
367367
golang.org/x/net v0.28.0 // indirect
368368
golang.org/x/oauth2 v0.22.0 // indirect

exporter/datadogexporter/go.sum

+4-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

exporter/datadogexporter/integrationtest/go.mod

+2-2
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ require (
5757
github.com/DataDog/datadog-agent/comp/logs/agent/config v0.56.2 // indirect
5858
github.com/DataDog/datadog-agent/comp/otelcol/logsagentpipeline v0.56.2 // indirect
5959
github.com/DataDog/datadog-agent/comp/otelcol/logsagentpipeline/logsagentpipelineimpl v0.56.2 // indirect
60-
github.com/DataDog/datadog-agent/comp/otelcol/otlp/components/exporter/logsagentexporter v0.56.2 // indirect
60+
github.com/DataDog/datadog-agent/comp/otelcol/otlp/components/exporter/logsagentexporter v0.58.0-devel.0.20240905201012-b02662b2ba27 // indirect
6161
github.com/DataDog/datadog-agent/comp/otelcol/otlp/components/metricsclient v0.56.2 // indirect
6262
github.com/DataDog/datadog-agent/comp/otelcol/otlp/components/statsprocessor v0.56.2 // indirect
6363
github.com/DataDog/datadog-agent/comp/trace/compression/def v0.56.2 // indirect
@@ -338,7 +338,7 @@ require (
338338
go.uber.org/multierr v1.11.0 // indirect
339339
go.uber.org/zap v1.27.0 // indirect
340340
golang.org/x/crypto v0.26.0 // indirect
341-
golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842 // indirect
341+
golang.org/x/exp v0.0.0-20240808152545-0cdaa3abc0fa // indirect
342342
golang.org/x/mod v0.20.0 // indirect
343343
golang.org/x/net v0.28.0 // indirect
344344
golang.org/x/oauth2 v0.22.0 // indirect

exporter/datadogexporter/integrationtest/go.sum

+4-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

exporter/datadogexporter/logs_exporter_test.go

+3
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,7 @@ func TestLogsAgentExporter(t *testing.T) {
295295
ldd := lrr.ResourceLogs().At(0).ScopeLogs().At(0).LogRecords().At(0)
296296
ldd.Attributes().PutStr("attr", "hello")
297297
ldd.Attributes().PutStr("service.name", "service")
298+
ldd.Attributes().PutStr("host.name", "test-host")
298299
return lrr
299300
}(),
300301
retry: false,
@@ -318,6 +319,8 @@ func TestLogsAgentExporter(t *testing.T) {
318319
"attr": "hello",
319320
"service": "service",
320321
"service.name": "service",
322+
"host.name": "test-host",
323+
"hostname": "test-host",
321324
},
322325
"ddsource": "otlp_log_ingestion",
323326
"ddtags": "otel_source:datadog_exporter",

0 commit comments

Comments
 (0)