From: Otto Moerbeek Date: Tue, 14 Oct 2025 11:05:05 +0000 (+0200) Subject: Rename a few things to alighn with dnsdist X-Git-Tag: rec-5.4.0-alpha1~178^2~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=20ff687632ddaf6f7a0bfe230ad5e63083c0aae4;p=thirdparty%2Fpdns.git Rename a few things to alighn with dnsdist Signed-off-by: Otto Moerbeek --- diff --git a/pdns/protozero-trace.hh b/pdns/protozero-trace.hh index c9c0779d30..b53cd54767 100644 --- a/pdns/protozero-trace.hh +++ b/pdns/protozero-trace.hh @@ -31,6 +31,7 @@ #include "dns_random.hh" #include "ednsoptions.hh" +#include "misc.hh" // See https://github.com/open-telemetry/opentelemetry-proto/tree/main/opentelemetry/proto @@ -694,13 +695,16 @@ struct TracesData return data; } - static TracesData boilerPlate(std::string&& service, std::string&& req, std::vector&& spans, const std::vector& attributes) + static TracesData boilerPlate(std::string&& service, std::vector&& spans, const std::vector& attributes, std::string& serverID) { auto& spanAttrs = spans.at(0).attributes; - spanAttrs.push_back({"arg", {std::move(req)}}); spanAttrs.insert(spanAttrs.end(), attributes.begin(), attributes.end()); + auto host = getHostname(); + std::string hostname = host.value_or("unset"); + InstrumentationScope scope{ + .name = "rec", .version = VERSION, .attributes = {{"hostname", {hostname}}, {"server.id", {serverID}}}}; return TracesData{ - .resource_spans = {pdns::trace::ResourceSpans{.resource = {.attributes = {{"service.name", {{std::move(service)}}}}}, .scope_spans = {{.spans = std::move(spans)}}}}}; + .resource_spans = {pdns::trace::ResourceSpans{.resource = {.attributes = {{"service.name", {{std::move(service)}}}}}, .scope_spans = {{.scope = scope, .spans = std::move(spans)}}}}}; } }; diff --git a/pdns/recursordist/pdns_recursor.cc b/pdns/recursordist/pdns_recursor.cc index 7994067f46..bd16f59057 100644 --- a/pdns/recursordist/pdns_recursor.cc +++ b/pdns/recursordist/pdns_recursor.cc @@ -1860,7 +1860,11 @@ void startDoResolve(void* arg) // NOLINT(readability-function-cognitive-complexi pbMessage.addEvents(resolver.d_eventTrace); } if (resolver.d_eventTrace.enabled() && SyncRes::eventTraceEnabled(SyncRes::event_trace_to_ot)) { - auto otTrace = pdns::trace::TracesData::boilerPlate("rec", comboWriter->d_mdp.d_qname.toLogString(), resolver.d_eventTrace.convertToOT(resolver.d_otTrace), {{"qtype", {QType(comboWriter->d_mdp.d_qtype).toString()}}}); + auto otTrace = pdns::trace::TracesData::boilerPlate("rec", resolver.d_eventTrace.convertToOT(resolver.d_otTrace), { + {"query.qname", {comboWriter->d_mdp.d_qname.toLogString()}}, + {"query.qtype", {QType(comboWriter->d_mdp.d_qtype).toString()}}, + }, + SyncRes::s_serverID); string otData = otTrace.encode(); pbMessage.setOpenTelemetryData(otData); } diff --git a/pdns/recursordist/rec-main.cc b/pdns/recursordist/rec-main.cc index a2e902a3f8..8c01a5eca7 100644 --- a/pdns/recursordist/rec-main.cc +++ b/pdns/recursordist/rec-main.cc @@ -633,7 +633,10 @@ void protobufLogResponse(const DNSName& qname, QType qtype, pbMessage.addEvents(eventTrace); } if (eventTrace.enabled() && (SyncRes::s_event_trace_enabled & SyncRes::event_trace_to_ot) != 0) { - auto trace = pdns::trace::TracesData::boilerPlate("rec", qname.toLogString(), eventTrace.convertToOT(otTrace), {{"qtype", {qtype.toString()}}}); + auto trace = pdns::trace::TracesData::boilerPlate("rec", eventTrace.convertToOT(otTrace), + {{"query.qname", {qname.toLogString()}}, + {"query.qtype", {qtype.toString()}}}, + SyncRes::s_serverID); pbMessage.setOpenTelemetryData(trace.encode()); } pbMessage.addPolicyTags(policyTags); diff --git a/pdns/recursordist/syncres.cc b/pdns/recursordist/syncres.cc index 8faa8c9005..5c4c9d74de 100644 --- a/pdns/recursordist/syncres.cc +++ b/pdns/recursordist/syncres.cc @@ -5454,7 +5454,7 @@ bool SyncRes::doResolveAtThisIP(const std::string& prefix, const DNSName& qname, s_ecsqueries++; } auto match = d_eventTrace.add(RecEventTrace::AuthRequest, qname.toLogString(), true, 0); - d_eventTrace.addExtraValues(match, {{"qtype", qtype.toString()}, {"ip", remoteIP.toStringWithPortExcept(53)}}); + d_eventTrace.addExtraValues(match, {{"query.qtype", qtype.toString()}, {"auth.address", remoteIP.toStringWithPortExcept(53)}}); updateQueryCounts(prefix, qname, remoteIP, doTCP, doDoT); resolveret = asyncresolveWrapper(LogObject(prefix), remoteIP, d_doDNSSEC, qname, auth, qtype.getCode(), doTCP, sendRDQuery, &d_now, ednsmask, &lwr, &chained, nsName); // <- we go out on the wire!