Skip to content

Commit

Permalink
Merge #1185 and add OnEvent for nosend::HttpClient
Browse files Browse the repository at this point in the history
Signed-off-by: owent <[email protected]>
  • Loading branch information
owent committed Feb 19, 2022
1 parent 99f7bdb commit db327de
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
3 changes: 2 additions & 1 deletion exporters/otlp/test/otlp_http_exporter_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -232,9 +232,10 @@ TEST_F(OtlpHttpExporterTestPeer, ExportBinaryIntegrationTest)
{
EXPECT_EQ("Custom-Header-Value", custom_header->second);
}

// let the otlp_http_client to continue
http_client::nosend::Response response;
callback.OnResponse(response);
response.Finish(callback);
});

child_span->End();
Expand Down
3 changes: 2 additions & 1 deletion exporters/otlp/test/otlp_http_log_exporter_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -167,9 +167,10 @@ TEST_F(OtlpHttpLogExporterTestPeer, ExportJsonIntegrationTest)
{
EXPECT_EQ("Custom-Header-Value", custom_header->second);
}

// let the otlp_http_client to continue
http_client::nosend::Response response;
callback.OnResponse(response);
response.Finish(callback);
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,19 @@ class Response : public opentelemetry::ext::http::client::Response
return status_code_;
}

void Finish(opentelemetry::ext::http::client::EventHandler &callback) noexcept
{
callback.OnEvent(opentelemetry::ext::http::client::SessionState::Created, "");
callback.OnEvent(opentelemetry::ext::http::client::SessionState::Connecting, "");
callback.OnEvent(opentelemetry::ext::http::client::SessionState::Connected, "");
callback.OnEvent(opentelemetry::ext::http::client::SessionState::Sending, "");

// let the otlp_http_client to continue
callback.OnResponse(*this);

callback.OnEvent(opentelemetry::ext::http::client::SessionState::Response, "");
}

public:
Headers headers_;
opentelemetry::ext::http::client::Body body_;
Expand Down

0 comments on commit db327de

Please sign in to comment.