diff options
author | Vlad Kuznetsov <va-kuznecov@ydb.tech> | 2024-01-10 16:58:08 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-10 16:58:08 +0100 |
commit | dff63525565b49b9530293809f1cc22fd0d1173f (patch) | |
tree | a7a5526e3d6f1c56e59ee176945f84af84dabf17 | |
parent | d0ffb6b83b2c98376250dd11c037e488bdbcdf70 (diff) | |
download | ydb-dff63525565b49b9530293809f1cc22fd0d1173f.tar.gz |
Get right TraceId in SessionActor (#908)
-rw-r--r-- | ydb/core/kqp/common/events/query.h | 7 | ||||
-rw-r--r-- | ydb/core/kqp/session_actor/kqp_query_state.h | 4 | ||||
-rw-r--r-- | ydb/core/kqp/session_actor/kqp_session_actor.cpp | 3 |
3 files changed, 10 insertions, 4 deletions
diff --git a/ydb/core/kqp/common/events/query.h b/ydb/core/kqp/common/events/query.h index 2f269d85f3..38fa0f63d9 100644 --- a/ydb/core/kqp/common/events/query.h +++ b/ydb/core/kqp/common/events/query.h @@ -161,6 +161,13 @@ public: return Record.GetTraceId(); } + NWilson::TTraceId GetWilsonTraceId() const { + if (RequestCtx) { + return RequestCtx->GetWilsonTraceId(); + } + return {}; + } + const TString& GetRequestType() const { if (RequestCtx) { if (!RequestType) { diff --git a/ydb/core/kqp/session_actor/kqp_query_state.h b/ydb/core/kqp/session_actor/kqp_query_state.h index 0eb2c0ee04..0d360e9225 100644 --- a/ydb/core/kqp/session_actor/kqp_query_state.h +++ b/ydb/core/kqp/session_actor/kqp_query_state.h @@ -35,7 +35,7 @@ public: TKqpQueryState(TEvKqp::TEvQueryRequest::TPtr& ev, ui64 queryId, const TString& database, const TString& cluster, TKqpDbCountersPtr dbCounters, bool longSession, const NKikimrConfig::TTableServiceConfig& tableServiceConfig, const NKikimrConfig::TQueryServiceConfig& queryServiceConfig, - NWilson::TTraceId&& traceId, const TString& sessionId, TMonotonic startedAt) + const TString& sessionId, TMonotonic startedAt) : QueryId(queryId) , Database(database) , Cluster(cluster) @@ -62,7 +62,7 @@ public: SetQueryDeadlines(tableServiceConfig, queryServiceConfig); auto action = GetAction(); KqpSessionSpan = NWilson::TSpan( - TWilsonKqp::KqpSession, std::move(traceId), + TWilsonKqp::KqpSession, std::move(RequestEv->GetWilsonTraceId()), "Session.query." + NKikimrKqp::EQueryAction_Name(action), NWilson::EFlags::AUTO_END); if (RequestEv->GetUserRequestContext()) { UserRequestContext = RequestEv->GetUserRequestContext(); diff --git a/ydb/core/kqp/session_actor/kqp_session_actor.cpp b/ydb/core/kqp/session_actor/kqp_session_actor.cpp index 368ae0f043..399740fbbc 100644 --- a/ydb/core/kqp/session_actor/kqp_session_actor.cpp +++ b/ydb/core/kqp/session_actor/kqp_session_actor.cpp @@ -213,8 +213,7 @@ public: ev->Get()->SetClientLostAction(selfId, as); QueryState = std::make_shared<TKqpQueryState>( ev, QueryId, Settings.Database, Settings.Cluster, Settings.DbCounters, Settings.LongSession, - Settings.TableService, Settings.QueryService, std::move(ev->TraceId), SessionId, - AppData()->MonotonicTimeProvider->Now()); + Settings.TableService, Settings.QueryService, SessionId, AppData()->MonotonicTimeProvider->Now()); if (QueryState->UserRequestContext->TraceId.empty()) { QueryState->UserRequestContext->TraceId = UlidGen.Next().ToString(); } |