Skip to content

Commit

Permalink
All 2xx return codes should be considered successful.
Browse files Browse the repository at this point in the history
  • Loading branch information
owent committed Jun 21, 2024
1 parent e1d9690 commit 7d6a11d
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion exporters/elasticsearch/src/es_log_record_exporter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class ResponseHandler : public http_client::EventHandler
// Store the body of the request
body_ = std::string(response.GetBody().begin(), response.GetBody().end());

if (response.GetStatusCode() != 200 && response.GetStatusCode() != 202)
if (!(response.GetStatusCode() >= 200 && response.GetStatusCode() <= 299))
{
log_message = BuildResponseLogMessage(response, body_);

Expand Down
2 changes: 1 addition & 1 deletion exporters/otlp/src/otlp_http_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ class ResponseHandler : public http_client::EventHandler
// Store the body of the request
body_ = std::string(response.GetBody().begin(), response.GetBody().end());

if (response.GetStatusCode() != 200 && response.GetStatusCode() != 202)
if (!(response.GetStatusCode() >= 200 && response.GetStatusCode() <= 299))
{
log_message = BuildResponseLogMessage(response, body_);

Expand Down
2 changes: 1 addition & 1 deletion exporters/zipkin/src/zipkin_exporter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ sdk::common::ExportResult ZipkinExporter::Export(
http_client::Body body_v(body_s.begin(), body_s.end());
auto result = http_client_->PostNoSsl(url_parser_.url_, body_v, options_.headers);
if (result &&
(result.GetResponse().GetStatusCode() == 200 || result.GetResponse().GetStatusCode() == 202))
(result.GetResponse().GetStatusCode() >= 200 || result.GetResponse().GetStatusCode() <= 299))
{
return sdk::common::ExportResult::kSuccess;
}
Expand Down

0 comments on commit 7d6a11d

Please sign in to comment.