Skip to content

[exporter/datadog] Fix duplicate sent log records in logs agent exporter #33887

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

Merged

Conversation

liustanley
Copy link
Contributor

@liustanley liustanley commented Jul 3, 2024

Description:

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:

Testing:
Verified locally that otelcol_exporter_sent_log_records reports the correct number of sent logs now, and added integration test.

Documentation:

Copy link
Member

@songy23 songy23 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add an integration test to validate it? You'll need to add a handler for api/v2/series in https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/exporter/datadogexporter/internal/testutil/logs.go#L42 then use the DatadogLogsServer

Copy link
Contributor

This PR was marked stale due to lack of activity. It will be closed in 14 days.

@github-actions github-actions bot added the Stale label Jul 18, 2024
@songy23 songy23 added never stale Issues marked with this label will be never staled and automatically removed and removed Stale labels Jul 18, 2024
@liustanley liustanley marked this pull request as ready for review July 23, 2024 19:56
@liustanley liustanley requested a review from a team July 23, 2024 19:56
@liustanley liustanley requested a review from songy23 July 23, 2024 20:29
@liustanley liustanley requested a review from songy23 July 25, 2024 14:29
Copy link
Member

@songy23 songy23 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@songy23 songy23 added the ready to merge Code review completed; ready to merge by maintainers label Jul 25, 2024
@mx-psi mx-psi merged commit 1311344 into open-telemetry:main Jul 26, 2024
161 checks passed
@mx-psi mx-psi deleted the stanley.liu/fix-logs-agent-sent-records branch July 26, 2024 13:09
@github-actions github-actions bot added this to the next release milestone Jul 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
exporter/datadog Datadog components never stale Issues marked with this label will be never staled and automatically removed ready to merge Code review completed; ready to merge by maintainers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants