From: Remi Gacogne Date: Tue, 26 May 2026 09:44:55 +0000 (+0200) Subject: dnsdist: Use a optional to distinguish between "not tested" and "not enabled" X-Git-Tag: auth-5.1.0~16^2~1 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=34a1411ef97bd33d20d5356fe7b17c4df020feea;p=thirdparty%2Fpdns.git dnsdist: Use a optional to distinguish between "not tested" and "not enabled" Signed-off-by: Remi Gacogne --- diff --git a/pdns/dnsdistdist/dnsdist-idstate.hh b/pdns/dnsdistdist/dnsdist-idstate.hh index 0d14823b57..ec31db0446 100644 --- a/pdns/dnsdistdist/dnsdist-idstate.hh +++ b/pdns/dnsdistdist/dnsdist-idstate.hh @@ -133,15 +133,16 @@ struct InternalQueryState #ifdef DISABLE_PROTOBUF return d_OTTracer; #else - if (!d_OTTracingEnabled || d_OTTracer != nullptr) { + if ((d_OTTracingEnabledInConfiguration && !*d_OTTracingEnabledInConfiguration) || d_OTTracer != nullptr) { return d_OTTracer; } if (dnsdist::configuration::getCurrentRuntimeConfiguration().d_openTelemetryTracing) { // OpenTelemetry tracing is enabled, but we don't have a tracer yet + d_OTTracingEnabledInConfiguration = true; d_OTTracer = pdns::trace::dnsdist::Tracer::getTracer(); } else { - d_OTTracingEnabled = false; + d_OTTracingEnabledInConfiguration = false; } return d_OTTracer; #endif @@ -233,6 +234,9 @@ public: uint16_t udpPayloadSize{0}; // Max UDP payload size from the query // 2 uint16_t sendTraceParentToDownstreamID{0}; // Whether or not to add a TRACEPARENT EDNS option to downstreams, set to non-0 for the EDNS Option ID std::optional dnssecOK; +#ifndef DISABLE_PROTOBUF + std::optional d_OTTracingEnabledInConfiguration; // Whether OpenTelemetry tracing is enabled in the configuration. This prevents having to check the configuration several times for the same query +#endif /* DISABLE_PROTOBUF */ // dnsdist::Protocol protocol; // 1 uint8_t restartCount{0}; // 1 bool ednsAdded{false}; @@ -245,7 +249,6 @@ public: bool staleCacheHit{false}; bool tracingEnabled{false}; // Whether or not Open Telemetry tracing is enabled for this query bool rulesAppliedToQuery{false}; // Whether applyRulesToQuery has been called for the query, used to determine if we need to trace - bool d_OTTracingEnabled{true}; // Whether OpenTelemetry tracing is enabled in the configuration. This prevents having to check the configuration several times for the same query struct rulesAppliedToQuerySetter { rulesAppliedToQuerySetter(bool& pastProcessRules) :