Skip to content

Commit 1311344

Browse files
authored
[exporter/datadog] Fix duplicate sent log records in logs agent exporter (#33887)
**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.--> We were calling `exporterhelper.NewLogsExporter` twice when instantiating the logs agent exporter: once in the datadogexporter factory method and once in the logs agent exporter factory method. This resulted in the `otelcol_exporter_sent_log_records` reporting double the amount of logs being sent. This PR removes the latter call by using `logsagentexporter.NewExporter` directly. **Link to tracking Issue:** <Issue number if applicable> **Testing:** <Describe what testing was performed and which tests were added.> Verified locally that `otelcol_exporter_sent_log_records` reports the correct number of sent logs now, and added integration test. **Documentation:** <Describe the documentation added.>
1 parent 49cee31 commit 1311344

File tree

7 files changed

+455
-18
lines changed

7 files changed

+455
-18
lines changed
Lines changed: 27 additions & 0 deletions
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: exporter/datadog
8+
9+
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
10+
note: Fixes a bug where `otelcol_exporter_sent_log_records` was reporting double as many logs sent when using the logs agent feature gate.
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: [33887]
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: []

exporter/datadogexporter/go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ require (
77
github.com/DataDog/datadog-agent/comp/core/config v0.56.0-rc.6
88
github.com/DataDog/datadog-agent/comp/core/hostname/hostnameinterface v0.56.0-rc.6
99
github.com/DataDog/datadog-agent/comp/core/log v0.56.0-rc.6
10-
github.com/DataDog/datadog-agent/comp/logs/agent/config v0.56.0-rc.6 // indirect
10+
github.com/DataDog/datadog-agent/comp/logs/agent/config v0.56.0-rc.6
1111
github.com/DataDog/datadog-agent/comp/otelcol/logsagentpipeline v0.56.0-rc.6
1212
github.com/DataDog/datadog-agent/comp/otelcol/logsagentpipeline/logsagentpipelineimpl v0.56.0-rc.6
1313
github.com/DataDog/datadog-agent/comp/otelcol/otlp/components/exporter/logsagentexporter v0.56.0-rc.6
@@ -21,6 +21,7 @@ require (
2121
github.com/DataDog/datadog-agent/pkg/logs/diagnostic v0.56.0-rc.6 // indirect
2222
github.com/DataDog/datadog-agent/pkg/logs/pipeline v0.56.0-rc.6 // indirect
2323
github.com/DataDog/datadog-agent/pkg/logs/sds v0.56.0-rc.6 // indirect
24+
github.com/DataDog/datadog-agent/pkg/logs/sources v0.56.0-rc.6
2425
github.com/DataDog/datadog-agent/pkg/logs/status/statusinterface v0.56.0-rc.6 // indirect
2526
github.com/DataDog/datadog-agent/pkg/proto v0.56.0-rc.6
2627
github.com/DataDog/datadog-agent/pkg/status/health v0.56.0-rc.6 // indirect
@@ -114,7 +115,6 @@ require (
114115
github.com/DataDog/datadog-agent/pkg/logs/metrics v0.56.0-rc.6 // indirect
115116
github.com/DataDog/datadog-agent/pkg/logs/processor v0.56.0-rc.6 // indirect
116117
github.com/DataDog/datadog-agent/pkg/logs/sender v0.56.0-rc.6 // indirect
117-
github.com/DataDog/datadog-agent/pkg/logs/sources v0.56.0-rc.6 // indirect
118118
github.com/DataDog/datadog-agent/pkg/logs/status/utils v0.56.0-rc.6 // indirect
119119
github.com/DataDog/datadog-agent/pkg/obfuscate v0.56.0-rc.6 // indirect
120120
github.com/DataDog/datadog-agent/pkg/remoteconfig/state v0.56.0-rc.6 // indirect

exporter/datadogexporter/integrationtest/go.mod

Lines changed: 71 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ require (
88
github.com/open-telemetry/opentelemetry-collector-contrib/connector/datadogconnector v0.105.0
99
github.com/open-telemetry/opentelemetry-collector-contrib/exporter/datadogexporter v0.105.0
1010
github.com/open-telemetry/opentelemetry-collector-contrib/processor/tailsamplingprocessor v0.105.0
11+
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/prometheusreceiver v0.105.0
1112
github.com/stretchr/testify v1.9.0
1213
github.com/tinylib/msgp v1.2.0
1314
go.opentelemetry.io/collector/component v0.105.1-0.20240717163034-43ed6184f9fe
@@ -25,14 +26,25 @@ require (
2526
go.opentelemetry.io/collector/receiver v0.105.1-0.20240717163034-43ed6184f9fe
2627
go.opentelemetry.io/collector/receiver/otlpreceiver v0.105.1-0.20240717163034-43ed6184f9fe
2728
go.opentelemetry.io/otel v1.28.0
29+
go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc v0.0.0-20240719082549-d2d94d6ae589
2830
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.28.0
2931
go.opentelemetry.io/otel/sdk v1.28.0
32+
go.opentelemetry.io/otel/sdk/log v0.4.0
3033
go.opentelemetry.io/otel/trace v1.28.0
3134
google.golang.org/protobuf v1.34.2
3235
)
3336

3437
require (
38+
cloud.google.com/go/auth v0.5.1 // indirect
39+
cloud.google.com/go/auth/oauth2adapt v0.2.2 // indirect
3540
cloud.google.com/go/compute/metadata v0.5.0 // indirect
41+
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.11.1 // indirect
42+
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.6.0 // indirect
43+
github.com/Azure/azure-sdk-for-go/sdk/internal v1.8.0 // indirect
44+
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5 v5.7.0 // indirect
45+
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4 v4.3.0 // indirect
46+
github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2 // indirect
47+
github.com/Code-Hex/go-generics-cache v1.5.1 // indirect
3648
github.com/DataDog/agent-payload/v5 v5.0.125 // indirect
3749
github.com/DataDog/datadog-agent/comp/core/config v0.56.0-rc.6 // indirect
3850
github.com/DataDog/datadog-agent/comp/core/flare/builder v0.56.0-rc.6 // indirect
@@ -106,6 +118,8 @@ require (
106118
github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp v1.24.0 // indirect
107119
github.com/Microsoft/go-winio v0.6.2 // indirect
108120
github.com/alecthomas/participle/v2 v2.1.1 // indirect
121+
github.com/alecthomas/units v0.0.0-20231202071711-9a357b53e9c9 // indirect
122+
github.com/armon/go-metrics v0.4.1 // indirect
109123
github.com/aws/aws-sdk-go v1.53.16 // indirect
110124
github.com/benbjohnson/clock v1.3.5 // indirect
111125
github.com/beorn7/perks v1.0.1 // indirect
@@ -114,89 +128,138 @@ require (
114128
github.com/cenkalti/backoff/v4 v4.3.0 // indirect
115129
github.com/cespare/xxhash/v2 v2.3.0 // indirect
116130
github.com/cihub/seelog v0.0.0-20170130134532-f561c5e57575 // indirect
131+
github.com/cncf/xds/go v0.0.0-20240423153145-555b57ec207b // indirect
117132
github.com/containerd/cgroups/v3 v3.0.3 // indirect
118133
github.com/coreos/go-systemd/v22 v22.5.0 // indirect
119134
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
135+
github.com/dennwc/varint v1.0.0 // indirect
136+
github.com/digitalocean/godo v1.117.0 // indirect
137+
github.com/distribution/reference v0.5.0 // indirect
138+
github.com/docker/docker v26.1.4+incompatible // indirect
139+
github.com/docker/go-connections v0.5.0 // indirect
120140
github.com/docker/go-units v0.5.0 // indirect
121141
github.com/dustin/go-humanize v1.0.1 // indirect
122142
github.com/emicklei/go-restful/v3 v3.11.0 // indirect
143+
github.com/envoyproxy/go-control-plane v0.12.0 // indirect
144+
github.com/envoyproxy/protoc-gen-validate v1.0.4 // indirect
123145
github.com/fatih/color v1.16.0 // indirect
124146
github.com/felixge/httpsnoop v1.0.4 // indirect
125147
github.com/fsnotify/fsnotify v1.7.0 // indirect
148+
github.com/go-kit/log v0.2.1 // indirect
149+
github.com/go-logfmt/logfmt v0.6.0 // indirect
126150
github.com/go-logr/logr v1.4.2 // indirect
127151
github.com/go-logr/stdr v1.2.2 // indirect
128152
github.com/go-ole/go-ole v1.3.0 // indirect
129153
github.com/go-openapi/jsonpointer v0.20.2 // indirect
130154
github.com/go-openapi/jsonreference v0.20.4 // indirect
131155
github.com/go-openapi/swag v0.22.9 // indirect
156+
github.com/go-resty/resty/v2 v2.13.1 // indirect
132157
github.com/go-viper/mapstructure/v2 v2.0.0-alpha.1 // indirect
158+
github.com/go-zookeeper/zk v1.0.3 // indirect
133159
github.com/gobwas/glob v0.2.3 // indirect
134160
github.com/goccy/go-json v0.10.3 // indirect
135161
github.com/godbus/dbus/v5 v5.0.6 // indirect
136162
github.com/gogo/protobuf v1.3.2 // indirect
163+
github.com/golang-jwt/jwt/v5 v5.2.1 // indirect
137164
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
138165
github.com/golang/mock v1.6.0 // indirect
139166
github.com/golang/protobuf v1.5.4 // indirect
140167
github.com/golang/snappy v0.0.4 // indirect
141168
github.com/google/gnostic-models v0.6.8 // indirect
142169
github.com/google/go-cmp v0.6.0 // indirect
170+
github.com/google/go-querystring v1.1.0 // indirect
143171
github.com/google/gofuzz v1.2.0 // indirect
172+
github.com/google/s2a-go v0.1.7 // indirect
144173
github.com/google/uuid v1.6.0 // indirect
174+
github.com/googleapis/enterprise-certificate-proxy v0.3.2 // indirect
175+
github.com/googleapis/gax-go/v2 v2.12.4 // indirect
176+
github.com/gophercloud/gophercloud v1.12.0 // indirect
177+
github.com/gorilla/websocket v1.5.0 // indirect
178+
github.com/grafana/regexp v0.0.0-20240518133315-a468a5bfb3bc // indirect
145179
github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0 // indirect
180+
github.com/hashicorp/consul/api v1.29.2 // indirect
181+
github.com/hashicorp/cronexpr v1.1.2 // indirect
146182
github.com/hashicorp/errwrap v1.1.0 // indirect
183+
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
184+
github.com/hashicorp/go-hclog v1.6.3 // indirect
185+
github.com/hashicorp/go-immutable-radix v1.3.1 // indirect
147186
github.com/hashicorp/go-multierror v1.1.1 // indirect
187+
github.com/hashicorp/go-retryablehttp v0.7.7 // indirect
188+
github.com/hashicorp/go-rootcerts v1.0.2 // indirect
148189
github.com/hashicorp/go-version v1.7.0 // indirect
190+
github.com/hashicorp/golang-lru v1.0.2 // indirect
149191
github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect
150192
github.com/hashicorp/hcl v1.0.0 // indirect
193+
github.com/hashicorp/nomad/api v0.0.0-20240604134157-e73d8bb1140d // indirect
194+
github.com/hashicorp/serf v0.10.1 // indirect
151195
github.com/hectane/go-acl v0.0.0-20190604041725-da78bae5fc95 // indirect
196+
github.com/hetznercloud/hcloud-go/v2 v2.9.0 // indirect
152197
github.com/iancoleman/strcase v0.3.0 // indirect
153198
github.com/imdario/mergo v0.3.16 // indirect
154199
github.com/inconshreveable/mousetrap v1.1.0 // indirect
200+
github.com/ionos-cloud/sdk-go/v6 v6.1.11 // indirect
155201
github.com/jmespath/go-jmespath v0.4.0 // indirect
156202
github.com/josharian/intern v1.0.0 // indirect
203+
github.com/jpillora/backoff v1.0.0 // indirect
157204
github.com/json-iterator/go v1.1.12 // indirect
158205
github.com/kardianos/osext v0.0.0-20190222173326-2bc1f35cddc0 // indirect
159206
github.com/karrick/godirwalk v1.17.0 // indirect
160207
github.com/klauspost/compress v1.17.9 // indirect
161208
github.com/knadh/koanf/maps v0.1.1 // indirect
162209
github.com/knadh/koanf/providers/confmap v0.1.0 // indirect
163210
github.com/knadh/koanf/v2 v2.1.1 // indirect
211+
github.com/kolo/xmlrpc v0.0.0-20220921171641-a4b6fa1dd06b // indirect
212+
github.com/kylelemons/godebug v1.1.0 // indirect
213+
github.com/linode/linodego v1.35.0 // indirect
164214
github.com/lufia/plan9stats v0.0.0-20220913051719-115f729f3c8c // indirect
165215
github.com/magiconair/properties v1.8.7 // indirect
166216
github.com/mailru/easyjson v0.7.7 // indirect
167217
github.com/mattn/go-colorable v0.1.13 // indirect
168218
github.com/mattn/go-isatty v0.0.20 // indirect
219+
github.com/miekg/dns v1.1.59 // indirect
169220
github.com/mitchellh/copystructure v1.2.0 // indirect
221+
github.com/mitchellh/go-homedir v1.1.0 // indirect
170222
github.com/mitchellh/mapstructure v1.5.1-0.20231216201459-8508981c8b6c // indirect
171223
github.com/mitchellh/reflectwalk v1.0.2 // indirect
224+
github.com/moby/docker-image-spec v1.3.1 // indirect
172225
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
173226
github.com/modern-go/reflect2 v1.0.2 // indirect
174227
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect
175228
github.com/mostynb/go-grpc-compression v1.2.3 // indirect
176229
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
230+
github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f // indirect
177231
github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/ecsutil v0.105.0 // indirect
178232
github.com/open-telemetry/opentelemetry-collector-contrib/internal/common v0.105.0 // indirect
179233
github.com/open-telemetry/opentelemetry-collector-contrib/internal/coreinternal v0.105.0 // indirect
180234
github.com/open-telemetry/opentelemetry-collector-contrib/internal/filter v0.105.0 // indirect
181235
github.com/open-telemetry/opentelemetry-collector-contrib/internal/k8sconfig v0.105.0 // indirect
182236
github.com/open-telemetry/opentelemetry-collector-contrib/internal/metadataproviders v0.105.0 // indirect
183237
github.com/open-telemetry/opentelemetry-collector-contrib/pkg/ottl v0.105.0 // indirect
238+
github.com/open-telemetry/opentelemetry-collector-contrib/pkg/pdatautil v0.105.0 // indirect
184239
github.com/open-telemetry/opentelemetry-collector-contrib/pkg/resourcetotelemetry v0.105.0 // indirect
240+
github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/prometheus v0.105.0 // indirect
241+
github.com/opencontainers/go-digest v1.0.0 // indirect
242+
github.com/opencontainers/image-spec v1.1.0 // indirect
185243
github.com/opencontainers/runtime-spec v1.1.0-rc.3 // indirect
186244
github.com/openshift/api v3.9.0+incompatible // indirect
187245
github.com/openshift/client-go v0.0.0-20210521082421-73d9475a9142 // indirect
188246
github.com/outcaste-io/ristretto v0.2.1 // indirect
247+
github.com/ovh/go-ovh v1.5.1 // indirect
189248
github.com/patrickmn/go-cache v2.1.0+incompatible // indirect
190249
github.com/pelletier/go-toml v1.9.5 // indirect
191250
github.com/philhofer/fwd v1.1.3-0.20240612014219-fbbf4953d986 // indirect
251+
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect
192252
github.com/pkg/errors v0.9.1 // indirect
193253
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
194254
github.com/power-devops/perfstat v0.0.0-20220216144756-c35f1ee13d7c // indirect
195255
github.com/prometheus/client_golang v1.19.1 // indirect
196256
github.com/prometheus/client_model v0.6.1 // indirect
197257
github.com/prometheus/common v0.55.0 // indirect
258+
github.com/prometheus/common/sigv4 v0.1.0 // indirect
198259
github.com/prometheus/procfs v0.15.1 // indirect
260+
github.com/prometheus/prometheus v0.53.1 // indirect
199261
github.com/rs/cors v1.11.0 // indirect
262+
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.27 // indirect
200263
github.com/secure-systems-lab/go-securesystemslib v0.7.0 // indirect
201264
github.com/shirou/gopsutil/v3 v3.24.5 // indirect
202265
github.com/shirou/gopsutil/v4 v4.24.6 // indirect
@@ -210,6 +273,7 @@ require (
210273
github.com/stretchr/objx v0.5.2 // indirect
211274
github.com/tklauser/go-sysconf v0.3.12 // indirect
212275
github.com/tklauser/numcpus v0.6.1 // indirect
276+
github.com/vultr/govultr/v2 v2.17.2 // indirect
213277
github.com/yusufpapurcu/wmi v1.2.4 // indirect
214278
go.opencensus.io v0.24.0 // indirect
215279
go.opentelemetry.io/collector v0.105.1-0.20240717163034-43ed6184f9fe // indirect
@@ -250,24 +314,28 @@ require (
250314
go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.28.0 // indirect
251315
go.opentelemetry.io/otel/log v0.4.0 // indirect
252316
go.opentelemetry.io/otel/metric v1.28.0 // indirect
253-
go.opentelemetry.io/otel/sdk/log v0.4.0 // indirect
254317
go.opentelemetry.io/otel/sdk/metric v1.28.0 // indirect
255318
go.opentelemetry.io/proto/otlp v1.3.1 // indirect
256319
go.uber.org/atomic v1.11.0 // indirect
257320
go.uber.org/dig v1.17.1 // indirect
258321
go.uber.org/fx v1.18.2 // indirect
259322
go.uber.org/multierr v1.11.0 // indirect
260323
go.uber.org/zap v1.27.0 // indirect
324+
golang.org/x/crypto v0.25.0 // indirect
261325
golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842 // indirect
326+
golang.org/x/mod v0.18.0 // indirect
262327
golang.org/x/net v0.27.0 // indirect
263328
golang.org/x/oauth2 v0.21.0 // indirect
329+
golang.org/x/sync v0.7.0 // indirect
264330
golang.org/x/sys v0.22.0 // indirect
265331
golang.org/x/term v0.22.0 // indirect
266332
golang.org/x/text v0.16.0 // indirect
267333
golang.org/x/time v0.5.0 // indirect
334+
golang.org/x/tools v0.22.0 // indirect
268335
gonum.org/v1/gonum v0.15.0 // indirect
269-
google.golang.org/genproto/googleapis/api v0.0.0-20240701130421-f6361c86f094 // indirect
270-
google.golang.org/genproto/googleapis/rpc v0.0.0-20240701130421-f6361c86f094 // indirect
336+
google.golang.org/api v0.183.0 // indirect
337+
google.golang.org/genproto/googleapis/api v0.0.0-20240711142825-46eb208f015d // indirect
338+
google.golang.org/genproto/googleapis/rpc v0.0.0-20240711142825-46eb208f015d // indirect
271339
google.golang.org/grpc v1.65.0 // indirect
272340
gopkg.in/inf.v0 v0.9.1 // indirect
273341
gopkg.in/ini.v1 v1.67.0 // indirect

0 commit comments

Comments
 (0)