diff options
| author | maybenotilya <[email protected]> | 2026-06-01 23:17:46 +0300 |
|---|---|---|
| committer | maybenotilya <[email protected]> | 2026-06-01 23:58:11 +0300 |
| commit | 25d27b87739eaf7a6254d961b62d5daa16ab44bf (patch) | |
| tree | 7b8d662b0cebdc32c75d14b4290e665ed0ffb91f /yt/cpp/mapreduce/client/client_reader.cpp | |
| parent | d1f86ecda9fdcf55e00df8d6d22ea39ac3f1edb0 (diff) | |
YT-27835: Add tracing for readers and writers
* Changelog entry
Type: fix
Component: cpp-sdk
Trace readers and writers with same trace_id
commit_hash:89a881e5bf608ca03821f248ef784f5f4771f532
Diffstat (limited to 'yt/cpp/mapreduce/client/client_reader.cpp')
| -rw-r--r-- | yt/cpp/mapreduce/client/client_reader.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/yt/cpp/mapreduce/client/client_reader.cpp b/yt/cpp/mapreduce/client/client_reader.cpp index f60bf8b8547..71d9c2df1c3 100644 --- a/yt/cpp/mapreduce/client/client_reader.cpp +++ b/yt/cpp/mapreduce/client/client_reader.cpp @@ -7,6 +7,7 @@ #include <yt/cpp/mapreduce/common/helpers.h> #include <yt/cpp/mapreduce/common/retry_lib.h> #include <yt/cpp/mapreduce/common/retry_request.h> +#include <yt/cpp/mapreduce/common/trace_context.h> #include <yt/cpp/mapreduce/common/wait_proxy.h> #include <yt/cpp/mapreduce/interface/config.h> @@ -50,7 +51,10 @@ TClientReader::TClientReader( , Format_(format) , Options_(options) , ReadTransaction_(nullptr) + , TraceContext_(NTracing::CreateTraceContext("TClientReader", context.Config)) { + NTracing::TCurrentTraceContextGuard guard(TraceContext_->Ptr); + if (options.CreateTransaction_) { Y_ABORT_UNLESS(transactionPinger, "Internal error: transactionPinger is null"); ReadTransaction_ = std::make_unique<TPingableTransaction>( @@ -83,6 +87,8 @@ bool TClientReader::Retry( const TMaybe<ui64>& rowIndex, const std::exception_ptr& error) { + NTracing::TCurrentTraceContextGuard guard(TraceContext_->Ptr); + // We always stop retries if reader is aborted if (IAbortableInputStream::IsAbortedError(error)) { std::rethrow_exception(error); @@ -148,6 +154,8 @@ bool TClientReader::IsAborted() const size_t TClientReader::DoRead(void* buf, size_t len) { + NTracing::TCurrentTraceContextGuard guard(TraceContext_->Ptr); + EnsureInitialized(); return Input_->Read(buf, len); } @@ -180,6 +188,8 @@ void TClientReader::TransformYPath() void TClientReader::CreateRequest(const TMaybe<ui32>& rangeIndex, const TMaybe<ui64>& rowIndex) { + NTracing::TCurrentTraceContextGuard guard(TraceContext_->Ptr); + if (!CurrentRequestRetryPolicy_) { CurrentRequestRetryPolicy_ = ClientRetryPolicy_->CreatePolicyForGenericRequest(); } |
