Skip to content

Conversation

mauri870
Copy link
Member

@mauri870 mauri870 commented Sep 5, 2025

Proposed commit message

This commit adds a test to verify that elasticsearchexporter applies
document-level retries correctly, and that the combination of
otelconsumer and the exporter guarantees at-least-once delivery when
a batch is acknowledged.

The test simulates retryable and permanent errors, checks that
max_retries is respected, and ensures that documents retried after
temporary failures are ingested while permanent failures are dropped.

Currenty, otelconsumer output metrics are not tracked correctly, and it
will always ACK the whole batch even if there were retries or dropped
events by the exporter.

Checklist

  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have made corresponding change to the default configuration files
  • I have added tests that prove my fix is effective or that my feature works
  • I have added an entry in CHANGELOG.next.asciidoc or CHANGELOG-developer.next.asciidoc.

How to test this PR locally

$ cd x-pack/filebeat
$ mage buildSystemTestBinary
$ go test -run ^TestFilebeatOTelDocumentLevelRetries$ -v -count=1 -tags=integration ./tests/integration
$ ./script/stresstest.sh --tags integration ./x-pack/filebeat/tests/integration ^TestFilebeatOTelDocumentLevelRetries$ -p 1
10m20s: 30 runs so far, 0 failures, 1 active
10m25s: 30 runs so far, 0 failures, 1 active

Related issues

@mauri870 mauri870 added this to the otel milestone Sep 5, 2025
@mauri870 mauri870 self-assigned this Sep 5, 2025
@mauri870 mauri870 added Team:Elastic-Agent-Data-Plane Label for the Agent Data Plane team backport-active-9 Automated backport with mergify to all the active 9.[0-9]+ branches backport-8.19 Automated backport to the 8.19 branch labels Sep 5, 2025
@botelastic botelastic bot added needs_team Indicates that the issue/PR needs a Team:* label and removed needs_team Indicates that the issue/PR needs a Team:* label labels Sep 5, 2025
Copy link
Contributor

github-actions bot commented Sep 5, 2025

🤖 GitHub comments

Expand to view the GitHub comments

Just comment with:

  • run docs-build : Re-trigger the docs validation. (use unformatted text in the comment!)

@mauri870 mauri870 marked this pull request as ready for review September 8, 2025 17:12
@mauri870 mauri870 requested a review from a team as a code owner September 8, 2025 17:12
@mauri870 mauri870 requested review from faec and leehinman September 8, 2025 17:12
@elasticmachine
Copy link
Collaborator

Pinging @elastic/elastic-agent-data-plane (Team:Elastic-Agent-Data-Plane)

@mauri870 mauri870 marked this pull request as draft September 9, 2025 13:23
@mauri870 mauri870 force-pushed the fbreceiver-mockes-test branch from 7a0f602 to 59942e6 Compare September 10, 2025 20:43
@mauri870 mauri870 force-pushed the fbreceiver-mockes-test branch from 05af572 to 56a5e5c Compare September 10, 2025 20:46
@mauri870
Copy link
Member Author

/test

Copy link
Contributor

mergify bot commented Sep 11, 2025

This pull request is now in conflicts. Could you fix it? 🙏
To fixup this pull request, you can check out it locally. See documentation: https://help.github.com/articles/checking-out-pull-requests-locally/

git fetch upstream
git checkout -b fbreceiver-mockes-test upstream/fbreceiver-mockes-test
git merge upstream/main
git push upstream fbreceiver-mockes-test

@mauri870
Copy link
Member Author

/test

@mauri870 mauri870 marked this pull request as ready for review September 11, 2025 19:56
@mauri870 mauri870 requested a review from a team as a code owner September 11, 2025 19:56
@mauri870
Copy link
Member Author

This is ready for review now, pending CI.

@mauri870 mauri870 requested a review from cmacknz September 12, 2025 01:39
Copy link
Contributor

mergify bot commented Sep 12, 2025

This pull request is now in conflicts. Could you fix it? 🙏
To fixup this pull request, you can check out it locally. See documentation: https://help.github.com/articles/checking-out-pull-requests-locally/

git fetch upstream
git checkout -b fbreceiver-mockes-test upstream/fbreceiver-mockes-test
git merge upstream/main
git push upstream fbreceiver-mockes-test

Copy link
Contributor

@VihasMakwana VihasMakwana left a comment

Choose a reason for hiding this comment

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

LGTM, just a nit.

@mauri870 mauri870 force-pushed the fbreceiver-mockes-test branch from 19ac3fe to 05a4cbf Compare September 12, 2025 09:51
@mauri870
Copy link
Member Author

mauri870 commented Sep 12, 2025

TestFilestreamTruncateBlockedOutput is flaking https://github.com/elastic/ingest-dev/issues/6087.

Edit: Fix here #46576.

@mauri870
Copy link
Member Author

@cmacknz When you have a chance, could you please review this and approve if it looks good? Thanks!

@mauri870 mauri870 enabled auto-merge (squash) September 12, 2025 19:55
@mauri870 mauri870 merged commit 2948886 into elastic:main Sep 12, 2025
207 checks passed
Copy link
Contributor

@Mergifyio backport 9.0 9.1

Copy link
Contributor

mergify bot commented Sep 12, 2025

backport 9.0 9.1

✅ Backports have been created

mergify bot pushed a commit that referenced this pull request Sep 12, 2025
…l retries (#46413)

* otel: add test for document-level retries

* fix linter errors

* add dummy assert for dropped events

* use deterministic handler from mock-es

* assert mock-es metrics

* sync go.mod and go.sum

* simplify handler logic

* update comments

* use slices.Contains

* go get mock-es latest

(cherry picked from commit 2948886)

# Conflicts:
#	NOTICE.txt
#	go.mod
#	go.sum
#	x-pack/filebeat/tests/integration/otel_test.go
mergify bot pushed a commit that referenced this pull request Sep 12, 2025
…l retries (#46413)

* otel: add test for document-level retries

* fix linter errors

* add dummy assert for dropped events

* use deterministic handler from mock-es

* assert mock-es metrics

* sync go.mod and go.sum

* simplify handler logic

* update comments

* use slices.Contains

* go get mock-es latest

(cherry picked from commit 2948886)

# Conflicts:
#	NOTICE.txt
#	go.mod
#	go.sum
#	x-pack/filebeat/tests/integration/otel_test.go
mergify bot pushed a commit that referenced this pull request Sep 12, 2025
…l retries (#46413)

* otel: add test for document-level retries

* fix linter errors

* add dummy assert for dropped events

* use deterministic handler from mock-es

* assert mock-es metrics

* sync go.mod and go.sum

* simplify handler logic

* update comments

* use slices.Contains

* go get mock-es latest

(cherry picked from commit 2948886)

# Conflicts:
#	NOTICE.txt
#	go.mod
#	go.sum
#	x-pack/filebeat/tests/integration/otel_test.go
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-8.19 Automated backport to the 8.19 branch backport-active-9 Automated backport with mergify to all the active 9.[0-9]+ branches Team:Elastic-Agent-Data-Plane Label for the Agent Data Plane team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants