Skip to content

Commit 1144788

Browse files
committed
wip 7/x
1 parent 441a9d4 commit 1144788

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

fuzz/w3c-propagation/fuzz.cpp

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,41 @@ namespace dd = datadog::tracing;
1515

1616
namespace {
1717

18+
// TODO: Move in `src` and be the default client if transport is `none`.
19+
class NullHttpClient : public dd::HTTPClient {
20+
public:
21+
dd::Expected<void> post(
22+
const URL& url, HeadersSetter set_headers, std::string body,
23+
ResponseHandler on_response, ErrorHandler on_error,
24+
std::chrono::steady_clock::time_point deadline) override {
25+
return {};
26+
}
27+
28+
// Wait until there are no more outstanding requests, or until the specified
29+
// `deadline`.
30+
void drain(std::chrono::steady_clock::time_point deadline) override {}
31+
32+
// Return a JSON representation of this object's configuration. The JSON
33+
// representation is an object with the following properties:
34+
//
35+
// - "type" is the unmangled, qualified name of the most-derived class, e.g.
36+
// "datadog::tracing::Curl".
37+
// - "config" is an object containing this object's configuration. "config"
38+
// may be omitted if the derived class has no configuration.
39+
std::string config() const override {
40+
return R"({"type": "NullHttpClient"})";
41+
};
42+
43+
~NullHttpClient() override = default;
44+
};
45+
1846
dd::Tracer& tracer_singleton() {
1947
thread_local auto tracer = []() {
2048
dd::TracerConfig config;
2149
config.service = "fuzzer";
2250
config.collector = std::make_shared<dd::NullCollector>();
2351
config.extraction_styles = {dd::PropagationStyle::W3C};
52+
config.agent.http_client = std::make_shared<NullHttpClient>();
2453

2554
const auto finalized_config = dd::finalize_config(config);
2655
if (!finalized_config) {

0 commit comments

Comments
 (0)