aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp
diff options
context:
space:
mode:
authoralexvru <alexvru@ydb.tech>2022-08-19 10:27:11 +0300
committeralexvru <alexvru@ydb.tech>2022-08-19 10:27:11 +0300
commite1dcf8f2a1ac55ca08605859d925559cabe89e6f (patch)
tree2ec57565e13cefe22b97489c887d8d8eba1592c7 /library/cpp
parent29d668fad4b1b4ebcc8b4935be04ccb616ba81a7 (diff)
downloadydb-e1dcf8f2a1ac55ca08605859d925559cabe89e6f.tar.gz
Fix Wilson verbosity and PipeCache TraceId forwarding
Diffstat (limited to 'library/cpp')
-rw-r--r--library/cpp/actors/interconnect/interconnect_channel.h6
-rw-r--r--library/cpp/actors/wilson/wilson_span.h24
-rw-r--r--library/cpp/actors/wilson/wilson_trace.h10
3 files changed, 24 insertions, 16 deletions
diff --git a/library/cpp/actors/interconnect/interconnect_channel.h b/library/cpp/actors/interconnect/interconnect_channel.h
index 8849d19b92c..58783d3c8d1 100644
--- a/library/cpp/actors/interconnect/interconnect_channel.h
+++ b/library/cpp/actors/interconnect/interconnect_channel.h
@@ -59,10 +59,10 @@ namespace NActors {
TEventHolder& event = Pool.Allocate(Queue);
const ui32 bytes = event.Fill(ev) + (Params.UseExtendedTraceFmt ? sizeof(TEventDescr2) : sizeof(TEventDescr1));
OutputQueueSize += bytes;
- if (auto span = NWilson::TSpan(15 /*max verbosity*/, NWilson::TTraceId(ev.TraceId), "Interconnect.Queue")) {
- event.Span = std::move(span
+ if (event.Span = NWilson::TSpan(15 /*max verbosity*/, NWilson::TTraceId(ev.TraceId), "Interconnect.Queue")) {
+ event.Span
.Attribute("OutputQueueItems", static_cast<i64>(Queue.size()))
- .Attribute("OutputQueueSize", static_cast<i64>(OutputQueueSize)));
+ .Attribute("OutputQueueSize", static_cast<i64>(OutputQueueSize));
}
return std::make_pair(bytes, &event);
}
diff --git a/library/cpp/actors/wilson/wilson_span.h b/library/cpp/actors/wilson/wilson_span.h
index 61243553a3d..a6ea2d921cd 100644
--- a/library/cpp/actors/wilson/wilson_span.h
+++ b/library/cpp/actors/wilson/wilson_span.h
@@ -81,17 +81,21 @@ namespace NWilson {
: nullptr)
{
if (Y_UNLIKELY(*this)) {
- if (!parentId.IsRoot()) {
- Data->Span.set_parent_span_id(parentId.GetSpanIdPtr(), parentId.GetSpanIdSize());
- }
- Data->Span.set_start_time_unix_nano(Data->StartTime.NanoSeconds());
- Data->Span.set_kind(opentelemetry::proto::trace::v1::Span::SPAN_KIND_INTERNAL);
-
- if (name) {
- Name(std::move(*name));
+ if (verbosity <= parentId.GetVerbosity()) {
+ if (!parentId.IsRoot()) {
+ Data->Span.set_parent_span_id(parentId.GetSpanIdPtr(), parentId.GetSpanIdSize());
+ }
+ Data->Span.set_start_time_unix_nano(Data->StartTime.NanoSeconds());
+ Data->Span.set_kind(opentelemetry::proto::trace::v1::Span::SPAN_KIND_INTERNAL);
+
+ if (name) {
+ Name(std::move(*name));
+ }
+
+ Attribute("node_id", NActors::TActivationContext::ActorSystem()->NodeId);
+ } else {
+ Data->Sent = true; // ignore this span due to verbosity mismatch, still allowing child spans to be created
}
-
- Attribute("node_id", NActors::TActivationContext::ActorSystem()->NodeId);
}
}
diff --git a/library/cpp/actors/wilson/wilson_trace.h b/library/cpp/actors/wilson/wilson_trace.h
index 8c1fe05b082..668d32e3068 100644
--- a/library/cpp/actors/wilson/wilson_trace.h
+++ b/library/cpp/actors/wilson/wilson_trace.h
@@ -187,9 +187,13 @@ namespace NWilson {
TTraceId Span(ui8 verbosity) const {
Validate();
- return *this && TimeToLive && verbosity <= Verbosity
- ? TTraceId(TraceId, GenerateSpanId(), Verbosity, TimeToLive - 1)
- : TTraceId();
+ if (!*this || !TimeToLive) {
+ return TTraceId();
+ } else if (verbosity <= Verbosity) {
+ return TTraceId(TraceId, GenerateSpanId(), Verbosity, TimeToLive - 1);
+ } else {
+ return TTraceId(TraceId, SpanId, Verbosity, TimeToLive - 1);
+ }
}
TTraceId Span() const { // compatibility stub