-
Notifications
You must be signed in to change notification settings - Fork 1
build(deps): bump dd-trace-cpp to v0.1.12 #6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
5b65789
d42b117
f07e398
a50976e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -51,12 +51,13 @@ class Tracer : public Tracing::Driver, private Logger::Loggable<Logger::Id::trac | |
| * cluster is retrieved in order to send HTTP request containing traces | ||
| * @param scope statistics scope from which \c TracerStats can be created | ||
| * @param thread_local_slot_allocator slot allocator for installing a | ||
| * thread-local instance of the tracer. | ||
| * thread-local instance of the tracer | ||
| * @param time_source clocks used for calculating HTTP request timeouts | ||
| */ | ||
| explicit Tracer(const std::string& collector_cluster, const std::string& collector_reference_host, | ||
| const datadog::tracing::TracerConfig& config, | ||
| Upstream::ClusterManager& cluster_manager, Stats::Scope& scope, | ||
| ThreadLocal::SlotAllocator& thread_local_slot_allocator); | ||
| ThreadLocal::SlotAllocator& thread_local_slot_allocator, TimeSource& time_source); | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please mention |
||
|
|
||
| struct ThreadLocalTracer : public ThreadLocal::ThreadLocalObject { | ||
| /** | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -49,7 +49,7 @@ class DatadogAgentHttpClientTest : public testing::Test { | |
| DatadogAgentHttpClientTest() | ||
| : request_(&cluster_manager_.instance_.thread_local_cluster_.async_client_), | ||
| stats_(makeTracerStats(*store_.rootScope())), | ||
| client_(cluster_manager_.instance_, "fake_cluster", "test_host", stats_) { | ||
| client_(cluster_manager_.instance_, "fake_cluster", "test_host", stats_, time_) { | ||
| url_.scheme = "http"; | ||
| url_.authority = "localhost:8126"; | ||
| url_.path = "/foo/bar"; | ||
|
|
@@ -67,6 +67,7 @@ class DatadogAgentHttpClientTest : public testing::Test { | |
| std::string body)> | ||
| on_response_; | ||
| testing::MockFunction<void(datadog::tracing::Error)> on_error_; | ||
| Event::SimulatedTimeSystem time_; | ||
| }; | ||
|
|
||
| TEST_F(DatadogAgentHttpClientTest, PathFromURL) { | ||
|
|
@@ -86,7 +87,8 @@ TEST_F(DatadogAgentHttpClientTest, PathFromURL) { | |
| EXPECT_CALL(request_, cancel()); | ||
|
|
||
| const auto ignore = [](auto&&...) {}; | ||
| datadog::tracing::Expected<void> result = client_.post(url_, ignore, "", ignore, ignore); | ||
| datadog::tracing::Expected<void> result = client_.post( | ||
| url_, ignore, "", ignore, ignore, time_.monotonicTime() + std::chrono::seconds(1)); | ||
| EXPECT_TRUE(result) << result.error(); | ||
| EXPECT_EQ(0, stats_.reports_skipped_no_cluster_.value()); | ||
| EXPECT_EQ(0, stats_.reports_failed_.value()); | ||
|
|
@@ -98,10 +100,11 @@ TEST_F(DatadogAgentHttpClientTest, MissingThreadLocalCluster) { | |
| // the "reports skipped no cluster" counter. | ||
|
|
||
| NiceMock<Upstream::MockClusterManager> cluster_manager; | ||
| AgentHTTPClient client(cluster_manager, "fake_cluster", "test_host", stats_); | ||
| AgentHTTPClient client(cluster_manager, "fake_cluster", "test_host", stats_, time_); | ||
|
|
||
| const auto ignore = [](auto&&...) {}; | ||
| datadog::tracing::Expected<void> result = client.post(url_, ignore, "", ignore, ignore); | ||
| datadog::tracing::Expected<void> result = client.post( | ||
| url_, ignore, "", ignore, ignore, time_.monotonicTime() + std::chrono::seconds(1)); | ||
| EXPECT_TRUE(result) << result.error(); | ||
| EXPECT_EQ(1, stats_.reports_skipped_no_cluster_.value()); | ||
| EXPECT_EQ(0, stats_.reports_failed_.value()); | ||
|
|
@@ -143,7 +146,8 @@ TEST_F(DatadogAgentHttpClientTest, RequestHeaders) { | |
| EXPECT_CALL(request_, cancel()); | ||
|
|
||
| const auto ignore = [](auto&&...) {}; | ||
| datadog::tracing::Expected<void> result = client_.post(url_, set_headers, "", ignore, ignore); | ||
| datadog::tracing::Expected<void> result = client_.post( | ||
| url_, set_headers, "", ignore, ignore, time_.monotonicTime() + std::chrono::seconds(1)); | ||
| EXPECT_TRUE(result) << result.error(); | ||
| EXPECT_EQ(0, stats_.reports_skipped_no_cluster_.value()); | ||
| EXPECT_EQ(0, stats_.reports_failed_.value()); | ||
|
|
@@ -182,7 +186,8 @@ TEST_F(DatadogAgentHttpClientTest, RequestBody) { | |
| EXPECT_CALL(request_, cancel()); | ||
|
|
||
| const auto ignore = [](auto&&...) {}; | ||
| datadog::tracing::Expected<void> result = client_.post(url_, ignore, body, ignore, ignore); | ||
| datadog::tracing::Expected<void> result = client_.post( | ||
| url_, ignore, body, ignore, ignore, time_.monotonicTime() + std::chrono::seconds(1)); | ||
| EXPECT_TRUE(result) << result.error(); | ||
| EXPECT_EQ(0, stats_.reports_skipped_no_cluster_.value()); | ||
| EXPECT_EQ(0, stats_.reports_failed_.value()); | ||
|
|
@@ -213,7 +218,8 @@ TEST_F(DatadogAgentHttpClientTest, OnResponse200) { | |
|
|
||
| const auto ignore = [](auto&&...) {}; | ||
| datadog::tracing::Expected<void> result = | ||
| client_.post(url_, ignore, "{}", on_response_.AsStdFunction(), on_error_.AsStdFunction()); | ||
| client_.post(url_, ignore, "{}", on_response_.AsStdFunction(), on_error_.AsStdFunction(), | ||
| time_.monotonicTime() + std::chrono::seconds(1)); | ||
| EXPECT_TRUE(result) << result.error(); | ||
|
|
||
| Http::ResponseMessagePtr msg(new Http::ResponseMessageImpl( | ||
|
|
@@ -252,7 +258,8 @@ TEST_F(DatadogAgentHttpClientTest, OnResponseNot200) { | |
|
|
||
| const auto ignore = [](auto&&...) {}; | ||
| datadog::tracing::Expected<void> result = | ||
| client_.post(url_, ignore, "{}", on_response_.AsStdFunction(), on_error_.AsStdFunction()); | ||
| client_.post(url_, ignore, "{}", on_response_.AsStdFunction(), on_error_.AsStdFunction(), | ||
| time_.monotonicTime() + std::chrono::seconds(1)); | ||
| EXPECT_TRUE(result) << result.error(); | ||
|
|
||
| // The "404" below is what causes `stats.reports_failed_` to be incremented | ||
|
|
@@ -293,7 +300,8 @@ TEST_F(DatadogAgentHttpClientTest, OnResponseBogusRequest) { | |
|
|
||
| const auto ignore = [](auto&&...) {}; | ||
| datadog::tracing::Expected<void> result = | ||
| client_.post(url_, ignore, "{}", on_response_.AsStdFunction(), on_error_.AsStdFunction()); | ||
| client_.post(url_, ignore, "{}", on_response_.AsStdFunction(), on_error_.AsStdFunction(), | ||
| time_.monotonicTime() + std::chrono::seconds(1)); | ||
| EXPECT_TRUE(result) << result.error(); | ||
|
|
||
| Http::ResponseMessagePtr msg(new Http::ResponseMessageImpl( | ||
|
|
@@ -333,7 +341,8 @@ TEST_F(DatadogAgentHttpClientTest, OnErrorStreamReset) { | |
|
|
||
| const auto ignore = [](auto&&...) {}; | ||
| datadog::tracing::Expected<void> result = | ||
| client_.post(url_, ignore, "{}", on_response_.AsStdFunction(), on_error_.AsStdFunction()); | ||
| client_.post(url_, ignore, "{}", on_response_.AsStdFunction(), on_error_.AsStdFunction(), | ||
| time_.monotonicTime() + std::chrono::seconds(1)); | ||
| EXPECT_TRUE(result) << result.error(); | ||
|
|
||
| Http::ResponseMessagePtr msg(new Http::ResponseMessageImpl( | ||
|
|
@@ -369,7 +378,8 @@ TEST_F(DatadogAgentHttpClientTest, OnErrorOther) { | |
|
|
||
| const auto ignore = [](auto&&...) {}; | ||
| datadog::tracing::Expected<void> result = | ||
| client_.post(url_, ignore, "{}", on_response_.AsStdFunction(), on_error_.AsStdFunction()); | ||
| client_.post(url_, ignore, "{}", on_response_.AsStdFunction(), on_error_.AsStdFunction(), | ||
| time_.monotonicTime() + std::chrono::seconds(1)); | ||
| EXPECT_TRUE(result) << result.error(); | ||
|
|
||
| Http::ResponseMessagePtr msg(new Http::ResponseMessageImpl( | ||
|
|
@@ -402,7 +412,8 @@ TEST_F(DatadogAgentHttpClientTest, OnErrorBogusRequest) { | |
|
|
||
| const auto ignore = [](auto&&...) {}; | ||
| datadog::tracing::Expected<void> result = | ||
| client_.post(url_, ignore, "{}", on_response_.AsStdFunction(), on_error_.AsStdFunction()); | ||
| client_.post(url_, ignore, "{}", on_response_.AsStdFunction(), on_error_.AsStdFunction(), | ||
| time_.monotonicTime() + std::chrono::seconds(1)); | ||
| EXPECT_TRUE(result) << result.error(); | ||
|
|
||
| Http::ResponseMessagePtr msg(new Http::ResponseMessageImpl( | ||
|
|
@@ -445,7 +456,8 @@ TEST_F(DatadogAgentHttpClientTest, SendFailReturnsError) { | |
|
|
||
| const auto ignore = [](auto&&...) {}; | ||
| datadog::tracing::Expected<void> result = | ||
| client_.post(url_, ignore, "", on_response_.AsStdFunction(), on_error_.AsStdFunction()); | ||
| client_.post(url_, ignore, "", on_response_.AsStdFunction(), on_error_.AsStdFunction(), | ||
| time_.monotonicTime() + std::chrono::seconds(1)); | ||
| ASSERT_FALSE(result); | ||
| EXPECT_EQ(datadog::tracing::Error::ENVOY_HTTP_CLIENT_FAILURE, result.error().code); | ||
| EXPECT_EQ(1, stats_.reports_failed_.value()); | ||
|
|
@@ -491,7 +503,8 @@ TEST_F(DatadogAgentHttpClientTest, SkipReportIfCollectorClusterHasBeenRemoved) { | |
|
|
||
| // Attempt to send a request. | ||
| const auto ignore = [](auto&&...) {}; | ||
| datadog::tracing::Expected<void> result = client_.post(url_, ignore, "", ignore, ignore); | ||
| datadog::tracing::Expected<void> result = client_.post( | ||
| url_, ignore, "", ignore, ignore, time_.monotonicTime() + std::chrono::seconds(1)); | ||
| EXPECT_TRUE(result); | ||
|
|
||
| // Verify observability. | ||
|
|
@@ -515,7 +528,8 @@ TEST_F(DatadogAgentHttpClientTest, SkipReportIfCollectorClusterHasBeenRemoved) { | |
|
|
||
| // Attempt to send a request. | ||
| const auto ignore = [](auto&&...) {}; | ||
| datadog::tracing::Expected<void> result = client_.post(url_, ignore, "", ignore, ignore); | ||
| datadog::tracing::Expected<void> result = client_.post( | ||
| url_, ignore, "", ignore, ignore, time_.monotonicTime() + std::chrono::seconds(1)); | ||
| EXPECT_TRUE(result); | ||
|
|
||
| // Verify observability. | ||
|
|
@@ -543,7 +557,8 @@ TEST_F(DatadogAgentHttpClientTest, SkipReportIfCollectorClusterHasBeenRemoved) { | |
|
|
||
| // Attempt to send a request. | ||
| const auto ignore = [](auto&&...) {}; | ||
| datadog::tracing::Expected<void> result = client_.post(url_, ignore, "", ignore, ignore); | ||
| datadog::tracing::Expected<void> result = client_.post( | ||
| url_, ignore, "", ignore, ignore, time_.monotonicTime() + std::chrono::seconds(1)); | ||
| EXPECT_TRUE(result); | ||
|
|
||
| // Complete in-flight request. | ||
|
|
@@ -570,7 +585,8 @@ TEST_F(DatadogAgentHttpClientTest, SkipReportIfCollectorClusterHasBeenRemoved) { | |
|
|
||
| // Attempt to send a request. | ||
| const auto ignore = [](auto&&...) {}; | ||
| datadog::tracing::Expected<void> result = client_.post(url_, ignore, "", ignore, ignore); | ||
| datadog::tracing::Expected<void> result = client_.post( | ||
| url_, ignore, "", ignore, ignore, time_.monotonicTime() + std::chrono::seconds(1)); | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please add a Regardless of whether we have a dedicated unit test, let's find out what timeouts actually do here within Envoy. |
||
| EXPECT_TRUE(result); | ||
|
|
||
| // Complete in-flight request. | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please mention
time_sourcein this contract.