]> git.ipfire.org Git - thirdparty/pdns.git/commit
feat(dnsdist): Speed up adding Spans in the Tracer
authorPieter Lexis <pieter.lexis@powerdns.com>
Fri, 31 Oct 2025 13:35:21 +0000 (14:35 +0100)
committerPieter Lexis <pieter.lexis@powerdns.com>
Tue, 4 Nov 2025 08:46:07 +0000 (09:46 +0100)
commit0d4d945c5aba810193e35ab198d5975f8ab8f92b
treed1f7ef6aaa656a50163ce033294cf8a75ac6dcf8
parentc1f29cf4683915135618894e35fcbc1e8fae76c6
feat(dnsdist): Speed up adding Spans in the Tracer

This makes the code cleaner, and does away with the pre- and
post-activation spans. We now have a "mini" span that we convert to
actual Spans only when they need to be sent out.

Using microbenchmarks the following became clear:

Adding a Span to the Tracer (using `Closer::openSpan`) is now about
45% slower than adding it to an old "unactivated" Tracer. But is is
*twice* as fast compared to the old "activated" Tracer.

When tracing is enabled for a query, most spans are added *after*
"activation". So this commit should speed up query processing when
tracing is enabled.

One downside of this commit is that generating the actual OpenTelemetry
Trace data we now need to create the real Spans, this generation is
about 60% slower. However, when the `delay` option is used for the
RemoteLogResponseAction this slowness is not in the hot path of the
query. As this generation happens after the response has been sent.

Signed-off-by: Pieter Lexis <pieter.lexis@powerdns.com>
pdns/dnsdistdist/dnsdist-actions-factory.cc
pdns/dnsdistdist/dnsdist-opentelemetry.cc
pdns/dnsdistdist/dnsdist-opentelemetry.hh
pdns/dnsdistdist/test-dnsdist-opentelemetry_cc.cc