Make sure buffer files are cleared at startup #159701

Open
mamazzol opened 10:28am on September 18, 2026 wants to merge 35 Δ into elastic/elasticsearch main from
otel-buffer-metrics

Pull Request Overview

  • Opened on September 18, 2026
  • Status Open
  • Commit count 8 with first commit September 18, 2026

Total Delta

35 Total Diff Delta

Open Days

Open 0 weekdays

Test Delta

25 Diff Delta in Test Files
Breakdown by Phase

How long has this pull request spent in each phase of its lifecycle?

Fraction of total time Business days Phase
 
0.1 days Authoring 1 commit before pull request opened for review
 
0.0 days Awaiting first review
 
0.7 days Revising work with 7 commits in response to 2 reviews that left 10 comments

Total time for pull request still awaiting merge: 0.8 business days

Author avatar

Make sure buffer files are cleared at startup

This PR fixes a telemetry bug for the buffer.
If there are files at startup from previous buffering, they will now be accounted for and registered in cachedFileCount so on a successful export, the cachedFileCount > 0 condition is true.
Until now, a failed export would be required to finally clear those pre-existing files.

Comments Threads Pending Resolution

mateuszrzeszutek reviewed on September 18, 2026
mateuszrzeszutek left a comment

Didn't we have an integration test for this scenario? `testOutageBuffersToDiskAndDrainsOnRecovery` seems to be working, perhaps it's worth correcting the assertions in it and making it fail first?

Resolved Comment Threads

mateuszrzeszutek reviewed on September 18, 2026
test/external-modules/apm-integration/src/javaRestTest/java/org/elasticsearch/test/apmintegration/OTelMetricsBufferSurvivesRestartIT.java
Outdated
61 57
        recordingApmServer.reset();
62 58
        recordingApmServer.clearResponseCode();
59
        cluster.restart(false);
60
        closeClients();
61
        initClient();