Repository navigation
Conversation
thc1006
force-pushed
the
fix/es-forceflush-deadline
branch
4 times, most recently
from
August 2, 2026 21:01
c8c0e4b to
bd0c772
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4337 +/- ##
==========================================
+ Coverage 86.63% 87.00% +0.38%
==========================================
Files 530 530
Lines 21183 21227 +44
==========================================
+ Hits 18349 18467 +118
+ Misses 2834 2760 -74
🚀 New features to boost your workflow:
|
This was referenced Aug 3, 2026
thc1006
force-pushed
the
fix/es-forceflush-deadline
branch
3 times, most recently
from
August 5, 2026 03:01
6085fad to
703f2b0
Compare
thc1006
force-pushed
the
fix/es-forceflush-deadline
branch
from
August 11, 2026 04:11
fac1be4 to
648de6e
Compare
thc1006
marked this pull request as draft
August 13, 2026 17:45
thc1006
force-pushed
the
fix/es-forceflush-deadline
branch
from
August 14, 2026 05:49
477d4ee to
dbfdde9
Compare
This was referenced Aug 14, 2026
thc1006
force-pushed
the
fix/es-forceflush-deadline
branch
from
August 15, 2026 08:48
a572304 to
80b050f
Compare
thc1006
force-pushed
the
fix/es-forceflush-deadline
branch
from
August 25, 2026 14:20
069dfde to
0eb3c55
Compare
thc1006
force-pushed
the
fix/es-forceflush-deadline
branch
from
August 31, 2026 09:50
0eb3c55 to
52470cf
Compare
Member
Author
|
The one red is This branch changes five files, all under The same job is green on I cannot re-run a job here, so it will clear on the next push or on a maintainer re-run. |
This was referenced Aug 31, 2026
thc1006
added a commit
to thc1006/opentelemetry-cpp
that referenced
this pull request
Aug 31, 2026
AsyncResponseHandler called the result callback directly from OnResponse and from each terminal OnEvent state with no guard, and ReadError, WriteError and Destroyed fell through a default label and called nothing. The HTTP client can deliver both a response and a terminal event for one request, so one export could report twice, and it can end on one of those three states and report nothing at all. The exporter counts one finished session per export. Reporting twice overshoots that count for the life of the exporter. Reporting never leaves a flush waiting on a session that has already ended. Every path goes through one CompleteOnce now, a compare exchange that reports at most once and keeps the first verdict. The switch lists every state with no default, so a state added upstream fails to compile rather than going uncounted, and the destructor reports a failure for a handler torn down without an outcome. The completion line said trace span(s) in the log exporter and says log record(s) now. The cases read that line to count outcomes, and the wording was wrong either way. Nine cases drive a fake HTTP client through the public constructor: each terminal ordering a real session can produce, a response and a teardown event in both orders, and the concurrent version of each. Removing the compare exchange turns six of the nine red. Extracted from open-telemetry#4337, which is 1526 lines and closes two issues. What stays there is the ForceFlush deadline and watermark accounting for open-telemetry#4336, including four completion cases that verify this guard through the flush rather than through the log line. Signed-off-by: thc1006 <[email protected]>
thc1006
force-pushed
the
fix/es-forceflush-deadline
branch
from
September 1, 2026 12:02
52470cf to
b3a560f
Compare
thc1006
added a commit
to thc1006/opentelemetry-cpp
that referenced
this pull request
Sep 1, 2026
AsyncResponseHandler called the result callback directly from OnResponse and from each terminal OnEvent state with no guard, and ReadError, WriteError and Destroyed fell through a default label and called nothing. The HTTP client can deliver both a response and a terminal event for one request, so one export could report twice, and it can end on one of those three states and report nothing at all. The exporter counts one finished session per export. Reporting twice overshoots that count for the life of the exporter. Reporting never leaves a flush waiting on a session that has already ended. Every path goes through one CompleteOnce now, a compare exchange that reports at most once and keeps the first verdict. The switch lists every state with no default, so a state added upstream fails to compile rather than going uncounted, and the destructor reports a failure for a handler torn down without an outcome. The completion line said trace span(s) in the log exporter and says log record(s) now. The cases read that line to count outcomes, and the wording was wrong either way. Nine cases drive a fake HTTP client through the public constructor: each terminal ordering a real session can produce, a response and a teardown event in both orders, and the concurrent version of each. Removing the compare exchange turns six of the nine red. Extracted from open-telemetry#4337, which is 1526 lines and closes two issues. What stays there is the ForceFlush deadline and watermark accounting for open-telemetry#4336, including four completion cases that verify this guard through the flush rather than through the log line. Signed-off-by: thc1006 <[email protected]>
thc1006
force-pushed
the
fix/es-forceflush-deadline
branch
from
September 1, 2026 12:14
b3a560f to
dfb0c34
Compare
thc1006
added a commit
to thc1006/opentelemetry-cpp
that referenced
this pull request
Sep 1, 2026
AsyncResponseHandler called the result callback directly from OnResponse and from each terminal OnEvent state with no guard, and ReadError, WriteError and Destroyed fell through a default label and called nothing. The HTTP client can deliver both a response and a terminal event for one request, so one export could report twice, and it can end on one of those three states and report nothing at all. The exporter counts one finished session per export. Reporting twice overshoots that count for the life of the exporter. Reporting never leaves a flush waiting on a session that has already ended. Every path goes through one CompleteOnce now, a compare exchange that reports at most once and keeps the first verdict. The switch lists every state with no default, so a state added upstream fails to compile rather than going uncounted, and the destructor reports a failure for a handler torn down without an outcome. The completion line said trace span(s) in the log exporter and says log record(s) now. The cases read that line to count outcomes, and the wording was wrong either way. Nine cases drive a fake HTTP client through the public constructor: each terminal ordering a real session can produce, a response and a teardown event in both orders, and the concurrent version of each. Removing the compare exchange turns six of the nine red. Extracted from open-telemetry#4337, which is 1526 lines and closes two issues. What stays there is the ForceFlush deadline and watermark accounting for open-telemetry#4336, including four completion cases that verify this guard through the flush rather than through the log line. Signed-off-by: thc1006 <[email protected]>
thc1006
force-pushed
the
fix/es-forceflush-deadline
branch
from
September 1, 2026 13:14
dfb0c34 to
c4033ed
Compare
AsyncResponseHandler called the result callback directly from OnResponse and from each terminal OnEvent state with no guard, and ReadError, WriteError and Destroyed fell through a default label and called nothing. The HTTP client can deliver both a response and a terminal event for one request, so one export could report twice, and it can end on one of those three states and report nothing at all. The exporter counts one finished session per export. Reporting twice overshoots that count for the life of the exporter. Reporting never leaves a flush waiting on a session that has already ended. Every path goes through one CompleteOnce now, a compare exchange that reports at most once and keeps the first verdict. The switch lists every state with no default, so a state added upstream fails to compile rather than going uncounted, and the destructor reports a failure for a handler torn down without an outcome. The completion line said trace span(s) in the log exporter and says log record(s) now. The cases read that line to count outcomes, and the wording was wrong either way. Nine cases drive a fake HTTP client through the public constructor: each terminal ordering a real session can produce, a response and a teardown event in both orders, and the concurrent version of each. Removing the compare exchange turns six of the nine red. Extracted from open-telemetry#4337, which is 1526 lines and closes two issues. What stays there is the ForceFlush deadline and watermark accounting for open-telemetry#4336, including four completion cases that verify this guard through the flush rather than through the log line. Signed-off-by: thc1006 <[email protected]>
Main's open-telemetry#4071 and open-telemetry#4501 put FakeResponse, FakeRequest, FakeSession and FakeHttpClient in an unnamed namespace at the top of this file, and this branch already had four of those names in a second unnamed namespace lower down. Reopening an unnamed namespace names the same namespace, so the rebase merged both with no conflict at all and left four redefinitions. One set now. The session and the client take a script and default to answering the way main's did, so main's own call site needs no edit. The script carries the handler as a shared_ptr rather than a reference, because the cases here have to keep it and send a second event to it, and the client keeps its on_create_session and on_cancel_all hooks, both empty by default. The default body stays as main wrote it. This branch does not change how the exporter decides success, so what main's cases send still passes here. Verified in both configurations with maintainer mode on: 12 cases, 12 passing with async export and 3 passing with 9 skipping without it. Removing CompleteOnce's compare and exchange turns six of them red, so the rewritten fixtures still discriminate. Signed-off-by: thc1006 <[email protected]>
…on identity ForceFlush waited for options_.response_timeout_ rather than the caller's timeout, and the timeout branch returned true whatever had happened, so every flush that ran out of time reported success. It also compared monotonic totals with no session identity, so a completion from a session started after the call could satisfy a waiter for one started before it, and a batch already inside Export() was not waited for at all. One steady_clock deadline taken at entry, and a wait on a predicate over the set of running session ids against a watermark. wait_until returns the predicate, so the answer is the caller's question rather than a leftover duration. The serialising lock is gone: each call snapshots what it waits for and publishes nothing, so two callers were already safe side by side. Stacked on open-telemetry#4502, which carries the exactly-once completion this accounting depends on. That half was extracted so each pull request closes one issue and is reviewable on its own. Signed-off-by: thc1006 <[email protected]>
thc1006
force-pushed
the
fix/es-forceflush-deadline
branch
from
September 8, 2026 06:50
c4033ed to
0109b5c
Compare
thc1006
added a commit
to thc1006/opentelemetry-cpp
that referenced
this pull request
Sep 21, 2026
AsyncResponseHandler called the result callback directly from OnResponse and from each terminal OnEvent state with no guard, and ReadError, WriteError and Destroyed fell through a default label and called nothing. The HTTP client can deliver both a response and a terminal event for one request, so one export could report twice, and it can end on one of those three states and report nothing at all. The exporter counts one finished session per export. Reporting twice overshoots that count for the life of the exporter. Reporting never leaves a flush waiting on a session that has already ended. Every path goes through one CompleteOnce now, a compare exchange that reports at most once and keeps the first verdict. The switch lists every state with no default, so a state added upstream fails to compile rather than going uncounted, and the destructor reports a failure for a handler torn down without an outcome. The completion line said trace span(s) in the log exporter and says log record(s) now. The cases read that line to count outcomes, and the wording was wrong either way. Nine cases drive a fake HTTP client through the public constructor: each terminal ordering a real session can produce, a response and a teardown event in both orders, and the concurrent version of each. Removing the compare exchange turns six of the nine red. Extracted from open-telemetry#4337, which is 1526 lines and closes two issues. What stays there is the ForceFlush deadline and watermark accounting for open-telemetry#4336, including four completion cases that verify this guard through the flush rather than through the log line. Signed-off-by: thc1006 <[email protected]>
Signed-off-by: thc1006 <[email protected]> # Conflicts: # CHANGELOG.md
Signed-off-by: thc1006 <[email protected]> # Conflicts: # CHANGELOG.md
Signed-off-by: thc1006 <[email protected]> # Conflicts: # CHANGELOG.md
Signed-off-by: thc1006 <[email protected]>
The ForceFlush contract is now ten lines, which is the longest doxygen block main carries in this header. Three others led with an abstraction and then explained it; they now name the function or the flag and stop. es_log_record_exporter_test passes 32 of 32 in the async build and clang-format 18.1.8 is clean on all three files. Signed-off-by: thc1006 <[email protected]>
Signed-off-by: thc1006 <[email protected]> # Conflicts: # CHANGELOG.md
Git merged the changelog without a conflict and still put the entry inside the 1.30.0 section, where it reads as already released. Rebuilt as main's changelog with this branch's two entries under Unreleased, so the only difference from main is those entries. Signed-off-by: thc1006 <[email protected]>
The Unreleased section is the only conflict. Rebuilt as main's changelog with this branch's entries under Unreleased. Signed-off-by: thc1006 <[email protected]>
thc1006
marked this pull request as ready for review
November 4, 2026 07:16
# Conflicts: # CHANGELOG.md
…tions They are compiled with and without async export and skip in synchronous builds. The section comment said they were built only with async export. Signed-off-by: thc1006 <[email protected]>
The default timeout is max, which the call turns into zero and then into the response timeout. The comment said the wait was bounded by the caller's timeout rather than the response timeout, which is only true for a positive timeout below max. Signed-off-by: thc1006 <[email protected]>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #4336.
The old wait could return true after a condition-variable timeout because it broke before subtracting the elapsed interval. A different wake-up path could exhaust the remaining duration and return false. The old implementation also waited on the response timeout and let unrelated later completions count toward a flush.
The asynchronous Elasticsearch exporter now snapshots the pending sessions at entry and waits against a steady-clock deadline. Only sessions in that snapshot can hold this flush open. Registration moves earlier in Export so a request being prepared is counted. A nonpositive normalized timeout uses the configured response timeout. If that too is zero, the predicate is checked without a positive wait budget. The result can still be true when all required sessions have finished. The installed header changes under ENABLE_ASYNC_EXPORT: SynchronizationData replaces its counters and recursive mutex with a session id and a set of running sessions, and a test peer becomes a friend.
Shutdown(timeout)still ignores its timeout, andtruefrom ForceFlush means each snapshotted export reported an outcome, not that its batch reached Elasticsearch (#3075).At 0aa468d the async exporter binary passed 32 cases. The synchronous build passed three and skipped 29. A separate check against the real async exporter exercised caller timeouts of zero and minus one microsecond with the response timeout at zero. Across 100 repetitions, an empty or completed snapshot returned true and a pending request returned false.
Please review #4502 first. It is the exactly-once completion work for #4338, extracted from this branch, which carries the same change. The branches currently share a merge base. When rebasing, preserve #4502's AFlushFromTheCompletionErrorDoesNotWaitForItsOwnSession case, which does not appear in this branch's test file. All 13 of #4502's selected async tests passed against this branch's production code in 20 shuffled runs. A local combined suite retained that case using this branch's flush-result assertion and passed all 33 selected async cases in 10 shuffled runs. With the session retired after the completion's error diagnostic instead of before it, that case failed in 5 of 5 runs while this branch's existing log-handler case still passed. OTLP client flush semantics are tracked separately in #4339. #4523 changes ForceFlush and
Shutdown(timeout)in the same file and conflicts with this branch, so whichever lands second has to keep #4523'sShutdown(timeout).