diff --git a/ydb/core/blobstorage/backpressure/queue.cpp b/ydb/core/blobstorage/backpressure/queue.cpp index fc83187df6a9..b2402a32c671 100644 --- a/ydb/core/blobstorage/backpressure/queue.cpp +++ b/ydb/core/blobstorage/backpressure/queue.cpp @@ -203,9 +203,9 @@ void TBlobStorageQueue::SendToVDisk(const TActorContext& ctx, const TActorId& re ++*QueueItemsSent; // send item - item.Span.Event("SendToVDisk", {{ + item.Span && item.Span.Event("SendToVDisk", { {"VDiskOrderNumber", vdiskOrderNumber} - }}); + }); item.Event.SendToVDisk(ctx, remoteVDisk, item.QueueCookie, item.MsgId, item.SequenceId, sendMeCostSettings, item.Span.GetTraceId(), ClientId, item.ProcessingTimer); diff --git a/ydb/core/blobstorage/vdisk/huge/blobstorage_hullhuge.cpp b/ydb/core/blobstorage/vdisk/huge/blobstorage_hullhuge.cpp index bf75aeaf74a4..79acac7304ef 100644 --- a/ydb/core/blobstorage/vdisk/huge/blobstorage_hullhuge.cpp +++ b/ydb/core/blobstorage/vdisk/huge/blobstorage_hullhuge.cpp @@ -193,7 +193,7 @@ LWTRACE_USING(BLOBSTORAGE_PROVIDER); "Writer: bootstrap: id# %s chunkId# %u offset# %u storedBlobSize# %u " "writtenSize# %u", HugeSlot.ToString().data(), chunkId, offset, storedBlobSize, writtenSize)); - Span.Event("Send_TEvChunkWrite", NWilson::TKeyValueList{{{"ChunkId", chunkId}, {"Offset", offset}, {"WrittenSize", writtenSize}}}); + Span && Span.Event("Send_TEvChunkWrite", {{"ChunkId", chunkId}, {"Offset", offset}, {"WrittenSize", writtenSize}}); auto ev = std::make_unique(HugeKeeperCtx->PDiskCtx->Dsk->Owner, HugeKeeperCtx->PDiskCtx->Dsk->OwnerRound, chunkId, offset, partsPtr, Cookie, true, GetWritePriority(), false); diff --git a/ydb/core/tablet_flat/flat_executor_txloglogic.cpp b/ydb/core/tablet_flat/flat_executor_txloglogic.cpp index d3aa1160d590..24ad5c0a9d2b 100644 --- a/ydb/core/tablet_flat/flat_executor_txloglogic.cpp +++ b/ydb/core/tablet_flat/flat_executor_txloglogic.cpp @@ -188,8 +188,9 @@ TLogicRedo::TCommitRWTransactionResult TLogicRedo::CommitRWTransaction( Batch->Commit->FirstTx->TxSpan.Attribute("BatchSize", batchSize); - seat->TxSpan.Attribute("Batched", true); - seat->TxSpan.Link(Batch->Commit->FirstTx->GetTxTraceId(), {}); + seat->TxSpan + .Attribute("Batched", true) + .Link(Batch->Commit->FirstTx->GetTxTraceId()); } Batch->Commit->PushTx(seat.Get()); diff --git a/ydb/library/actors/wilson/wilson_span.h b/ydb/library/actors/wilson/wilson_span.h index 9cbf0f8c2d56..3db7786a0bf0 100644 --- a/ydb/library/actors/wilson/wilson_span.h +++ b/ydb/library/actors/wilson/wilson_span.h @@ -159,29 +159,32 @@ namespace NWilson { return *this; } - TSpan& Name(TString name) { + template + TSpan& Name(T&& name) { if (Y_UNLIKELY(*this)) { - Data->Span.set_name(std::move(name)); + Data->Span.set_name(std::forward(name)); } else { VerifyNotSent(); } return *this; } - TSpan& Attribute(TString name, TAttributeValue value) { + template + TSpan& Attribute(T&& name, T1&& value) { if (Y_UNLIKELY(*this)) { - SerializeKeyValue(std::move(name), std::move(value), Data->Span.add_attributes()); + SerializeKeyValue(std::forward(name), std::forward(value), Data->Span.add_attributes()); } else { VerifyNotSent(); } return *this; } - TSpan& Event(TString name, TKeyValueList attributes) { + template>> + TSpan& Event(T&& name, T1&& attributes) { if (Y_UNLIKELY(*this)) { auto *event = Data->Span.add_events(); event->set_time_unix_nano(TimeUnixNano()); - event->set_name(std::move(name)); + event->set_name(std::forward(name)); for (auto&& [key, value] : attributes) { SerializeKeyValue(std::move(key), std::move(value), event->add_attributes()); } @@ -191,7 +194,13 @@ namespace NWilson { return *this; } - TSpan& Link(const TTraceId& traceId, TKeyValueList attributes) { + template + TSpan& Event(T&& name) { + return Event(std::forward(name), {}); + } + + template>> + TSpan& Link(const TTraceId& traceId, T&& attributes) { if (Y_UNLIKELY(*this)) { auto *link = Data->Span.add_links(); link->set_trace_id(traceId.GetTraceIdPtr(), traceId.GetTraceIdSize()); @@ -205,6 +214,10 @@ namespace NWilson { return *this; } + TSpan& Link(const TTraceId& traceId) { + return Link(traceId, {}); + } + void EndOk() { if (Y_UNLIKELY(*this)) { auto *status = Data->Span.mutable_status(); @@ -215,11 +228,12 @@ namespace NWilson { } } - void EndError(TString error) { + template + void EndError(T&& error) { if (Y_UNLIKELY(*this)) { auto *status = Data->Span.mutable_status(); status->set_code(NTraceProto::Status::STATUS_CODE_ERROR); - status->set_message(std::move(error)); + status->set_message(std::forward(error)); End(); } else { VerifyNotSent();