From: Otto Moerbeek Date: Thu, 19 Jun 2025 09:03:43 +0000 (+0200) Subject: Distinguish argument value and return value X-Git-Tag: rec-5.3.0-alpha1^2~3 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=86fb657223480320c46a25adb594b367588c025f;p=thirdparty%2Fpdns.git Distinguish argument value and return value Having full attribute names is something for later (maybe). Signed-off-by: Otto Moerbeek --- diff --git a/pdns/protozero-trace.hh b/pdns/protozero-trace.hh index 25cf7cb9ad..ffa73c7c16 100644 --- a/pdns/protozero-trace.hh +++ b/pdns/protozero-trace.hh @@ -673,7 +673,7 @@ struct TracesData static TracesData boilerPlate(std::string&& service, std::string&& req, std::vector&& spans) { - spans.at(0).attributes.push_back({"value", {std::move(req)}}); + spans.at(0).attributes.push_back({"arg", {std::move(req)}}); return TracesData{ .resource_spans = {pdns::trace::ResourceSpans{.resource = {.attributes = {{"service.name", {{std::move(service)}}}}}, .scope_spans = {{.spans = std::move(spans)}}}}}; } diff --git a/pdns/recursordist/rec-eventtrace.cc b/pdns/recursordist/rec-eventtrace.cc index c8cc69b744..5c63e946e0 100644 --- a/pdns/recursordist/rec-eventtrace.cc +++ b/pdns/recursordist/rec-eventtrace.cc @@ -44,22 +44,23 @@ const std::unordered_map RecEventTrace::s using namespace pdns::trace; -static void addValue(const RecEventTrace::Entry& event, Span& work) +static void addValue(const RecEventTrace::Entry& event, Span& work, bool start) { if (std::holds_alternative(event.d_value)) { return; } + const string key = start ? "arg" : "result"; if (std::holds_alternative(event.d_value)) { - work.attributes.emplace_back(KeyValue{"value", {std::get(event.d_value)}}); + work.attributes.emplace_back(KeyValue{key, {std::get(event.d_value)}}); } else if (std::holds_alternative(event.d_value)) { - work.attributes.emplace_back(KeyValue{"value", {std::get(event.d_value)}}); + work.attributes.emplace_back(KeyValue{key, {std::get(event.d_value)}}); } else if (std::holds_alternative(event.d_value)) { - work.attributes.emplace_back(KeyValue{"value", {std::get(event.d_value)}}); + work.attributes.emplace_back(KeyValue{key, {std::get(event.d_value)}}); } else { - work.attributes.emplace_back(KeyValue{"value", {RecEventTrace::toString(event.d_value)}}); + work.attributes.emplace_back(KeyValue{key, {RecEventTrace::toString(event.d_value)}}); } } @@ -103,7 +104,7 @@ std::vector RecEventTrace::convertToOT(const Span& span) cons } // Assign a span id. random(work.span_id); - addValue(event, work); + addValue(event, work, true); spanIDs.emplace_back(work.span_id); ret.emplace_back(work); ids[index] = ret.size() - 1; @@ -112,7 +113,7 @@ std::vector RecEventTrace::convertToOT(const Span& span) cons // It's a close event if (ids.find(event.d_matching) != ids.end()) { auto& work = ret.at(ids.at(event.d_matching)); - addValue(event, work); + addValue(event, work, false); work.end_time_unix_nano = static_cast(event.d_ts + diff); spanIDs.emplace_back(work.span_id); }