And drop hostname as a result.
#include "config.h"
#include "dnsdist-configuration.hh"
+#include "dnsdist-opentelemetry.hh"
#include "dnsdist.hh"
#include "dnsdist-async.hh"
#include "dnsdist-dnsparser.hh"
tracer->setRootSpanAttribute("query.qtype", AnyValue{QType(dnsquestion->ids.qtype).toString()});
tracer->setRootSpanAttribute("query.remote.address", AnyValue{dnsquestion->ids.origRemote.toString()});
tracer->setRootSpanAttribute("query.remote.port", AnyValue{dnsquestion->ids.origRemote.getPort()});
+ tracer->setTraceAttribute("instance", AnyValue{dnsdist::configuration::getCurrentRuntimeConfiguration().d_server_id});
if (d_sendDownstreamTraceparent) {
dnsquestion->ids.sendTraceParentToDownstreamID = d_traceparentOptionCode;
*/
#include "dnsdist-opentelemetry.hh"
-#include "misc.hh"
#include "dnsdist-ecs.hh"
#include <memory>
namespace pdns::trace::dnsdist
{
-#ifndef DISABLE_PROTOBUF
-static const KeyValue hostnameAttr{.key = "hostname", .value = {getHostname().value_or("")}};
-#endif
-
TracesData Tracer::getTracesData()
{
#ifdef DISABLE_PROTOBUF
},
.spans = {}}}}}};
- otTrace.resource_spans.at(0).scope_spans.at(0).scope.attributes.push_back(hostnameAttr);
-
for (auto const& span : data->d_spans) {
otTrace.resource_spans.at(0).scope_spans.at(0).spans.push_back(
{
BOOST_CHECK_EQUAL(trace.resource_spans.at(0).resource.attributes.at(0).key, "service.name");
// Check if we have a hostname
- BOOST_CHECK_EQUAL(trace.resource_spans.at(0).scope_spans.at(0).scope.attributes.size(), 2U);
+ BOOST_CHECK_EQUAL(trace.resource_spans.at(0).scope_spans.at(0).scope.attributes.size(), 1U);
BOOST_CHECK_EQUAL(trace.resource_spans.at(0).scope_spans.at(0).scope.attributes.at(0).key, "foo");
BOOST_CHECK_EQUAL(trace.resource_spans.at(0).scope_spans.at(0).scope.attributes.at(0).value, AnyValue{"bar"});
-
- BOOST_CHECK_EQUAL(trace.resource_spans.at(0).scope_spans.at(0).scope.attributes.at(1).key, "hostname");
}
BOOST_AUTO_TEST_CASE(spanAttributes)
{
auto tracer = pdns::trace::dnsdist::Tracer::getTracer();
auto data = tracer->getOTProtobuf();
- BOOST_TEST(data.size() >= 100U);
+ BOOST_TEST(data.size() >= 50U);
tracer->setTraceAttribute("foo", AnyValue{"bar"});
data = tracer->getOTProtobuf();
- BOOST_TEST(data.size() >= 110U);
+ BOOST_TEST(data.size() >= 60U);
}
BOOST_AUTO_TEST_CASE(setTraceID)
"attributes"
]
]
- self.assertListEqual(msg_scope_attr_keys, ["hostname"])
+ self.assertListEqual(msg_scope_attr_keys, ["instance"])
root_span_attr_keys = [
v["key"]