Skip to content

Commit 105e421

Browse files
authored
fix(system-tests): set end time when a span is closed (#228)
Changes: - Add `dev` preset. - Remove unecessary include. - Capture and set end time in `on_span_end`.
1 parent bb4891d commit 105e421

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

CMakePresets.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,10 @@
2525
"displayName": "Development",
2626
"cacheVariables": {
2727
"CMAKE_BUILD_TYPE": "Debug",
28-
"DD_TRACE_ENABLE_SANITIZE": "ON",
28+
"DD_TRACE_ENABLE_SANITIZE": "OFF",
2929
"DD_TRACE_BUILD_TESTING": "ON",
30-
"DD_TRACE_BUILD_EXAMPLES": "ON"
30+
"DD_TRACE_BUILD_EXAMPLES": "ON",
31+
"DD_TRACE_BUILD_FUZZERS": "OFF"
3132
}
3233
}
3334
]

test/system-tests/request_handler.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ void RequestHandler::on_span_start(const httplib::Request& req,
154154

155155
void RequestHandler::on_span_end(const httplib::Request& req,
156156
httplib::Response& res) {
157+
const auto now = std::chrono::steady_clock::now();
157158
const auto request_json = nlohmann::json::parse(req.body);
158159

159160
auto span_id = utils::get_if_exists<uint64_t>(request_json, "span_id");
@@ -168,6 +169,7 @@ void RequestHandler::on_span_end(const httplib::Request& req,
168169
VALIDATION_ERROR(res, msg);
169170
}
170171

172+
span_it->second.set_end_time(now);
171173
res.status = 200;
172174
}
173175

test/system-tests/request_handler.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
#include "developer_noise.h"
1111
#include "httplib.h"
1212
#include "manual_scheduler.h"
13-
#include "utils.h"
1413

1514
class RequestHandler final {
1615
public:

0 commit comments

Comments
 (0)