]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Distinguish argument value and return value
authorOtto Moerbeek <otto.moerbeek@open-xchange.com>
Thu, 19 Jun 2025 09:03:43 +0000 (11:03 +0200)
committerOtto Moerbeek <otto.moerbeek@open-xchange.com>
Thu, 19 Jun 2025 09:03:43 +0000 (11:03 +0200)
Having full attribute names is something for later (maybe).

Signed-off-by: Otto Moerbeek <otto.moerbeek@open-xchange.com>
pdns/protozero-trace.hh
pdns/recursordist/rec-eventtrace.cc

index 25cf7cb9add53963545b0d2797671cd90462c7c2..ffa73c7c163d7289de4369e8653792ee6b52da1b 100644 (file)
@@ -673,7 +673,7 @@ struct TracesData
 
   static TracesData boilerPlate(std::string&& service, std::string&& req, std::vector<Span>&& 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)}}}}};
   }
index c8cc69b7447ca8bf710e023432372404e27bcf9a..5c63e946e0abe74ed0b398cad7f5dff2f1566fb9 100644 (file)
@@ -44,22 +44,23 @@ const std::unordered_map<RecEventTrace::EventType, std::string> 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<std::nullopt_t>(event.d_value)) {
     return;
   }
+  const string key = start ? "arg" : "result";
   if (std::holds_alternative<bool>(event.d_value)) {
-    work.attributes.emplace_back(KeyValue{"value", {std::get<bool>(event.d_value)}});
+    work.attributes.emplace_back(KeyValue{key, {std::get<bool>(event.d_value)}});
   }
   else if (std::holds_alternative<int64_t>(event.d_value)) {
-    work.attributes.emplace_back(KeyValue{"value", {std::get<int64_t>(event.d_value)}});
+    work.attributes.emplace_back(KeyValue{key, {std::get<int64_t>(event.d_value)}});
   }
   else if (std::holds_alternative<std::string>(event.d_value)) {
-    work.attributes.emplace_back(KeyValue{"value", {std::get<std::string>(event.d_value)}});
+    work.attributes.emplace_back(KeyValue{key, {std::get<std::string>(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<pdns::trace::Span> 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<pdns::trace::Span> 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<uint64_t>(event.d_ts + diff);
         spanIDs.emplace_back(work.span_id);
       }