You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[BUG] Elasticsearch exporter decides bulk success by substring instead of the errors field #4295
if (responseBody.find("\"failed\" : 0") == std::string::npos)
if (body_.find("\"failed\" : 0") == std::string::npos)
Three problems with that test.
failed is not the bulk outcome. In a bulk response, failed appears under _shards for an individual item. The result for the batch as a whole is the top level errors boolean. A body where one item has "failed": 0 and another item failed outright still matches the substring and is reported as a success.
It depends on pretty-printed spacing. The literal contains " : ". Elasticsearch only formats that way when the request asks for it, so a compact response never matches and a completely successful export is reported as a failure.
The asynchronous path ignores the HTTP status.AsyncResponseHandler::OnResponse only inspects the body, so a 4xx or 5xx with a body that happens to contain the substring is treated as a success. The synchronous path does check the status, in ResponseHandler::OnResponse.
Suggested fix
Parse the body and check the top level errors field, and check the HTTP status on both paths. nlohmann/json.hpp is already included by this file and already linked in both the CMake and Bazel targets, so this needs no new dependency. A malformed or unparseable body should count as a failure rather than being ignored.
Still present on main at e4232d8e: both call sites decide from find("\"failed\" : 0") as before, and errors does not appear anywhere in es_log_record_exporter.cc.
#4297 carries the fix and is based on current main.
Activity
[BUG] Parse the Elasticsearch bulk response instead of matching a sub…
Fold the HTTP status into the bulk export result on both paths
[BUG] Parse the Elasticsearch bulk response instead of matching a sub…
Fold the HTTP status into the bulk export result on both paths
Drop the item-count check; trust the top-level errors flag
Cover the path the response takes to the verdict
Cover the path the response takes to the verdict
Cover the path the response takes to the verdict
github-actions commentedon Sep 24, 2026
This issue was marked as stale due to lack of activity.
thc1006 commentedon Oct 2, 2026
Still present on
mainate4232d8e: both call sites decide fromfind("\"failed\" : 0")as before, anderrorsdoes not appear anywhere ines_log_record_exporter.cc.#4297 carries the fix and is based on current main.