aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/actors/wilson
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/actors/wilson
parent29d668fad4b1b4ebcc8b4935be04ccb616ba81a7 (diff)
downloadydb-e1dcf8f2a1ac55ca08605859d925559cabe89e6f.tar.gz
Fix Wilson verbosity and PipeCache TraceId forwarding
Diffstat (limited to 'library/cpp/actors/wilson')
-rw-r--r--library/cpp/actors/wilson/wilson_span.h24
-rw-r--r--library/cpp/actors/wilson/wilson_trace.h10
2 files changed, 21 insertions, 13 deletions
diff --git a/library/cpp/actors/wilson/wilson_span.h b/library/cpp/actors/wilson/wilson_span.h
index 61243553a3..a6ea2d921c 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 8c1fe05b08..668d32e306 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