Skip to content

[8.19](backport #46413) otel: add test for otelconsumer + elasticsearchexporter document-level retries#46616

Merged
mauri870 merged 8 commits into8.19from
mergify/bp/8.19/pr-46413
Oct 20, 2025
Merged

[8.19](backport #46413) otel: add test for otelconsumer + elasticsearchexporter document-level retries#46616
mauri870 merged 8 commits into8.19from
mergify/bp/8.19/pr-46413

Conversation

@mergify
Copy link
Copy Markdown
Contributor

@mergify mergify Bot commented Sep 12, 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

…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 mergify Bot requested a review from a team as a code owner September 12, 2025 19:56
@mergify mergify Bot added backport conflicts There is a conflict in the backported pull request labels Sep 12, 2025
@mergify mergify Bot requested a review from a team as a code owner September 12, 2025 19:56
@mergify mergify Bot requested review from rdner and removed request for a team September 12, 2025 19:56
@mergify
Copy link
Copy Markdown
Contributor Author

mergify Bot commented Sep 12, 2025

Cherry-pick of 2948886 has failed:

On branch mergify/bp/8.19/pr-46413
Your branch is up to date with 'origin/8.19'.

You are currently cherry-picking commit 29488865a.
  (fix conflicts and run "git cherry-pick --continue")
  (use "git cherry-pick --skip" to skip this patch)
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

Unmerged paths:
  (use "git add <file>..." to mark resolution)
	both modified:   NOTICE.txt
	both modified:   go.mod
	both modified:   go.sum
	both modified:   x-pack/filebeat/tests/integration/otel_test.go

no changes added to commit (use "git add" and/or "git commit -a")

To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally

@mergify mergify Bot requested a review from mauri870 September 12, 2025 19:56
@botelastic botelastic Bot added the needs_team Indicates that the issue/PR needs a Team:* label label Sep 12, 2025
@github-actions github-actions Bot added the Team:Elastic-Agent-Data-Plane Label for the Agent Data Plane team label Sep 12, 2025
@elasticmachine
Copy link
Copy Markdown
Contributor

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

@botelastic botelastic Bot removed the needs_team Indicates that the issue/PR needs a Team:* label label Sep 12, 2025
@mauri870 mauri870 force-pushed the mergify/bp/8.19/pr-46413 branch from e333700 to 192d70d Compare September 12, 2025 20:04
@mauri870 mauri870 enabled auto-merge (squash) September 12, 2025 20:43
@mauri870
Copy link
Copy Markdown
Member

This needs some adjustment from a breaking change in mock-es api.NewApiHandler to use otel sdk metrics.

@mergify
Copy link
Copy Markdown
Contributor Author

mergify Bot commented Sep 15, 2025

This pull request has not been merged yet. Could you please review and merge it @mauri870? 🙏

1 similar comment
@mergify
Copy link
Copy Markdown
Contributor Author

mergify Bot commented Sep 22, 2025

This pull request has not been merged yet. Could you please review and merge it @mauri870? 🙏

@mergify
Copy link
Copy Markdown
Contributor Author

mergify Bot commented Sep 29, 2025

This pull request has not been merged yet. Could you please review and merge it @mauri870? 🙏

2 similar comments
@mergify
Copy link
Copy Markdown
Contributor Author

mergify Bot commented Oct 6, 2025

This pull request has not been merged yet. Could you please review and merge it @mauri870? 🙏

@mergify
Copy link
Copy Markdown
Contributor Author

mergify Bot commented Oct 13, 2025

This pull request has not been merged yet. Could you please review and merge it @mauri870? 🙏

@pierrehilbert
Copy link
Copy Markdown
Contributor

@mauri870 could you please resolve the conflicts?

@mauri870
Copy link
Copy Markdown
Member

Thanks for the reminder. This is on my to-do list, but since it requires some missing backports due to breaking changes in mock-es, I’ve been postponing it because of other priorities. I should have all backports merged this week.

@mauri870
Copy link
Copy Markdown
Member

Depends on the following backport #47089.

@mergify
Copy link
Copy Markdown
Contributor Author

mergify Bot commented Oct 20, 2025

This pull request has not been merged yet. Could you please review and merge it @mauri870? 🙏

@mergify
Copy link
Copy Markdown
Contributor Author

mergify Bot commented Oct 20, 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 mergify/bp/8.19/pr-46413 upstream/mergify/bp/8.19/pr-46413
git merge upstream/8.19
git push upstream mergify/bp/8.19/pr-46413

@mauri870 mauri870 merged commit 6aeb52d into 8.19 Oct 20, 2025
200 of 203 checks passed
@mauri870 mauri870 deleted the mergify/bp/8.19/pr-46413 branch October 20, 2025 16:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport conflicts There is a conflict in the backported pull request 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