Skip to content

Commit 25fac4c

Browse files
committed
avoid flushing the extra span
1 parent 07aa32b commit 25fac4c

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

test/system-tests/request_handler.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,8 @@ void RequestHandler::on_extract_headers(const httplib::Request& req,
257257

258258
res.set_content(response_body.dump(), "application/json");
259259
http_headers_.emplace(span->parent_id().value(), std::move(*http_headers));
260+
// The span below will not be finished and flushed.
261+
extract_headers_spans_.emplace(span->parent_id().value(), std::move(*span));
260262
}
261263

262264
void RequestHandler::on_span_flush(const httplib::Request& /* req */,

test/system-tests/request_handler.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ class RequestHandler final {
3838
std::shared_ptr<ManualScheduler> scheduler_;
3939
std::shared_ptr<DeveloperNoiseLogger> logger_;
4040
std::unordered_map<uint64_t, datadog::tracing::Span> active_spans_;
41+
std::unordered_map<uint64_t, datadog::tracing::Span> extract_headers_spans_;
4142
std::unordered_map<uint64_t, nlohmann::json::array_t> http_headers_;
4243

4344
#undef VALIDATION_ERROR

0 commit comments

Comments
 (0)