Repository navigation
Conversation
Signed-off-by: thc1006 <[email protected]>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4297 +/- ##
==========================================
+ Coverage 86.63% 86.67% +0.05%
==========================================
Files 530 531 +1
Lines 21183 21248 +65
==========================================
+ Hits 18349 18415 +66
+ Misses 2834 2833 -1
🚀 New features to boost your workflow:
|
Review of open-telemetry#4297 found the synchronous path reported a non-2xx response as a success: ResponseHandler::OnResponse only logged the status and unconditionally set response_received_, waitForResponse returned true, and Export then checked the body alone, so HTTP 500 with a body of {"errors":false} became kSuccess. My description claiming the sync path already checked the status was wrong: it observed the status but never let it affect the ExportResult. IsBulkResponseSuccessful now takes the status code and treats a non-2xx as a failure before looking at the body. The top-level "errors" flag is item-level and cannot override a transport or application error. Both paths call it: the async handler drops its duplicated status check, and the sync handler stores the status so Export can pass it in. Tests assert the invariant directly, including HTTP 500 with {"errors":false} on the sync-shaped path, plus the errors:true generic reason and the missing item-error branches. A full handler-level mock across HttpClient/Session is out of scope: the exporter has no such mock today (its network tests are DISABLED_), and the status invariant is what the bug was, so it is covered at the validator instead. Fixes open-telemetry#4295 Signed-off-by: thc1006 <[email protected]>
Signed-off-by: thc1006 <[email protected]>
Review of open-telemetry#4297 found the synchronous path reported a non-2xx response as a success: ResponseHandler::OnResponse only logged the status and unconditionally set response_received_, waitForResponse returned true, and Export then checked the body alone, so HTTP 500 with a body of {"errors":false} became kSuccess. My description claiming the sync path already checked the status was wrong: it observed the status but never let it affect the ExportResult. IsBulkResponseSuccessful now takes the status code and treats a non-2xx as a failure before looking at the body. The top-level "errors" flag is item-level and cannot override a transport or application error. Both paths call it: the async handler drops its duplicated status check, and the sync handler stores the status so Export can pass it in. Tests assert the invariant directly, including HTTP 500 with {"errors":false} on the sync-shaped path, plus the errors:true generic reason and the missing item-error branches. A full handler-level mock across HttpClient/Session is out of scope: the exporter has no such mock today (its network tests are DISABLED_), and the status invariant is what the bug was, so it is covered at the validator instead. Fixes open-telemetry#4295 Signed-off-by: thc1006 <[email protected]>
d751066 to
229ee19
Compare
189419b to
0283411
Compare
49cf38c to
223618d
Compare
7a381fb to
c7cf4e9
Compare
|
Eighteen days and no human has looked at this yet. The one review on it is Copilot reporting that it could not run because the requester was out of quota, and CI has been green throughout. So here is the short entry point that What it does. Both export paths decided a bulk write had succeeded with Where to look, if you would rather spot check than read it all.
Two choices I flagged as open, which I am now closing rather than leaving on you. I raised them because both are firsts for this repository, not because I think they are wrong, and re-reading the description I can see that asking for two decisions on top of a review is a good reason to defer the whole thing.
Both stay as they are unless you would rather they did not. Say the word on either and I will change it, but nothing is waiting on an answer. Edited 16 Aug. It is a draft now, and that is my doing rather than anything about the code. Reading it alongside #4331 and #4337 turned up two gaps I had not pinned: no asynchronous case carried a non-200 status through to the parser, and no successful case carried more than one record, so either could have been hard-coded without a test noticing. Both are measured now, with the mutation that used to pass and no longer does. The original text said 18 August; that clock is paused while it sits in draft, and I have folded the follow-up comment in here rather than leave two to read. Edited 3 October. I have taken out a line that said I would bring this to the C++ SIG meeting if it was still unlooked-at. I am not going to, and leaving it there read as a threat. @dbarker asked on #4448 for a map of the related open issues and their priority, and I sent one. @om7057 reviewed the sibling change on #4502 and found a real error in a comment of mine. Curl fixes kept landing through September. None of that is the neglect that clause in |
2be3585 to
04152bf
Compare
…the log assertions Three things the cases were getting away with. The deferred helper published the handler into a slot beside the promise and signalled with the promise. EXPECT_EQ is not fatal, so when the five second handoff wait timed out the helper carried on and read that slot while the exporter's thread could still be writing it. A wait that times out has not observed the promise becoming ready, so those two accesses have nothing ordering them and the failure path was itself undefined. The handler now travels in the promise and is taken from the future, and each precondition reports and returns instead of leaving the rest of the helper to run on state it just said was wrong. The cases that read the exporter's error lines now sit on their own fixture. Below error level OTEL_INTERNAL_LOG_ERROR expands to nothing rather than being filtered, so with -DOTEL_INTERNAL_LOG_LEVEL=0 the ones expecting the winner to report failed on correct code and the ones expecting silence from the loser passed without testing anything. Measured: with the fixture, twelve pass and those six skip; move one back and it fails expecting one line and finding none. The accepted bulk body now names an index. open-telemetry#4297 requires a string _index in every index acknowledgement, so without it every success case here would be read as a failure once these two meet, which is the opposite of what this file's comment promised. The two deferred cases are renamed for what they hold. The session publishes the handler before SendRequest() returns, so they cover a callback delivered after the handoff while the export is still running, not a waiter proven to be inside cv_.wait(). Signed-off-by: thc1006 <[email protected]>
4a4b935 to
1f80e02
Compare
…the log assertions Three things the cases were getting away with. The deferred helper published the handler into a slot beside the promise and signalled with the promise. EXPECT_EQ is not fatal, so when the five second handoff wait timed out the helper carried on and read that slot while the exporter's thread could still be writing it. A wait that times out has not observed the promise becoming ready, so those two accesses have nothing ordering them and the failure path was itself undefined. The handler now travels in the promise and is taken from the future, and each precondition reports and returns instead of leaving the rest of the helper to run on state it just said was wrong. The cases that read the exporter's error lines now sit on their own fixture. Below error level OTEL_INTERNAL_LOG_ERROR expands to nothing rather than being filtered, so with -DOTEL_INTERNAL_LOG_LEVEL=0 the ones expecting the winner to report failed on correct code and the ones expecting silence from the loser passed without testing anything. Measured: with the fixture, twelve pass and those six skip; move one back and it fails expecting one line and finding none. The accepted bulk body now names an index. open-telemetry#4297 requires a string _index in every index acknowledgement, so without it every success case here would be read as a failure once these two meet, which is the opposite of what this file's comment promised. The two deferred cases are renamed for what they hold. The session publishes the handler before SendRequest() returns, so they cover a callback delivered after the handoff while the export is still running, not a waiter proven to be inside cv_.wait(). Signed-off-by: thc1006 <[email protected]>
04a1b0c to
f23c186
Compare
Both export paths decided whether a bulk write had succeeded by searching the response body for the literal `"failed" : 0`. That field is per-shard information for a single item rather than the outcome of the batch, which is the top-level `errors` flag, and the literal baked in pretty-printing whitespace besides. It was wrong in both directions: a batch holding a rejected item read as success, and a compact successful response read as failure. One helper, `IsBulkResponseSuccessful(status_code, body, expected_items, reason)`, now answers for both paths. A non-2xx status fails first. Then the body has to be a JSON object carrying a boolean `errors` flag and an `items` array with one operation result per operation the request submitted, and `errors` has to be false. A malformed body is a failure rather than a silent success, and the reason the helper reports is the one written to the log. Squashed from fourteen commits so the rebase onto main resolves once rather than at every step. No content change: the tree is identical to the one the fourteen produced. Signed-off-by: thc1006 <[email protected]>
…ccepts Main grew its own FakeResponse, FakeRequest, FakeSession and FakeHttpClient in open-telemetry#4071 and open-telemetry#4501, in an unnamed namespace, and this branch already had four of the same names in another unnamed namespace in the same file. Reopening an unnamed namespace names the same namespace, so the rebase merged both without a conflict into four redefinitions that do not compile. Merged rather than renamed. Main's set is used once and answers with one fixed response; this branch's runs a script the case supplies, which is the general case. So the session and the client take a script and default to answering the way main's did, and the existing call site is untouched. The default body had to change too, which is not cosmetic. It read `{"errors": false, "failed" : 0}`, and this pull request stops reading `failed` and starts requiring one `items` result per submitted record, so that body is now rejected: with it, ExportingARecordWithInvalidUtf8DoesNotAbort returns kFailure and fails. The default is now a body a server could send for a one record batch, and the comment that described the old substring search is rewritten. Verified in both configurations, since the guards cut different code: 26 tests, 22 passed and 4 skipped without async export, 20 passed and 6 skipped with it, no failures in either. Signed-off-by: thc1006 <[email protected]>
f23c186 to
d08ae97
Compare
…the log assertions Three things the cases were getting away with. The deferred helper published the handler into a slot beside the promise and signalled with the promise. EXPECT_EQ is not fatal, so when the five second handoff wait timed out the helper carried on and read that slot while the exporter's thread could still be writing it. A wait that times out has not observed the promise becoming ready, so those two accesses have nothing ordering them and the failure path was itself undefined. The handler now travels in the promise and is taken from the future, and each precondition reports and returns instead of leaving the rest of the helper to run on state it just said was wrong. The cases that read the exporter's error lines now sit on their own fixture. Below error level OTEL_INTERNAL_LOG_ERROR expands to nothing rather than being filtered, so with -DOTEL_INTERNAL_LOG_LEVEL=0 the ones expecting the winner to report failed on correct code and the ones expecting silence from the loser passed without testing anything. Measured: with the fixture, twelve pass and those six skip; move one back and it fails expecting one line and finding none. The accepted bulk body now names an index. open-telemetry#4297 requires a string _index in every index acknowledgement, so without it every success case here would be read as a failure once these two meet, which is the opposite of what this file's comment promised. The two deferred cases are renamed for what they hold. The session publishes the handler before SendRequest() returns, so they cover a callback delivered after the handoff while the export is still running, not a waiter proven to be inside cv_.wait(). 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]> # Conflicts: # CHANGELOG.md
The three es_bulk_response.h contracts restated themselves, and a test section banner carried its own rules. IsBulkResponseSuccessful keeps 16 lines, over the 10 that is main's longest doxygen in this component, because it documents four parameters and a four-part return condition. es_log_record_exporter_test passes 22 with 4 skipped in the synchronous build, and clang-format 18.1.8 is clean. Signed-off-by: thc1006 <[email protected]>
The 1.30.0 release rewrote the Unreleased section, which is the whole conflict. Both sides kept, ours after main's. Signed-off-by: thc1006 <[email protected]>
The 1.30.0 release rewrote that section, and resolving the conflict in place left this entry inside the released block, where it reads as shipped. Rebuilt as main's file with this branch's entry inserted under Unreleased, so the only difference from main is the entry itself. Signed-off-by: thc1006 <[email protected]>
The only conflict is the Unreleased section again. Rebuilt as main's changelog with this branch's entries inserted 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]>
# Conflicts: # CHANGELOG.md
Fixes #4295.
Both export paths decided bulk success by searching the response body for
"failed" : 0, without reading the HTTP status. A batch with a rejected item could therefore read as success, a compact successful response as failure, and an HTTP 500 as success when its body contained that exact marker. Both export paths now pass the HTTP status, response body and number of submitted records to the same parser.This exporter sends unfiltered index operations. A successful response has HTTP status 200, a Boolean errors field set to false and one acknowledgement per submitted operation. Each item must contain one index result with a string _index, integer status 200 or 201, and no non-null error. An alias may resolve to a different concrete index name. The response and item status predicates are distinct.
The parser is private to the exporter. Its detail header is excluded from the CMake install and has package-private Bazel visibility. #4327 previously excluded the HTTP client's internal detail headers from the CMake install as well. This adds the repository's first Bazel
implementation_deps. If you would rather list the header in the exporter'shdrs, or move the parser intosrc/, I can change it. The bulk request URI also drops?pretty, since the parser does not depend on pretty-printed whitespace.At 6406682 a standalone test of the actual helper checked 30,000 combinations of HTTP status, item status, errors and submitted count. It found zero mismatches with exceptions enabled and zero in a second 30,000-case run with exceptions disabled. The CMake Install Tests run on this head stopped during the build when its runner shut down (exit 143). The separate CI workflow passed.