Skip to content

Commit

Permalink
KIKIMR-20533 Forward traceparent header to KV-tablet (#689)
Browse files Browse the repository at this point in the history
* KIKIMR-20533 Forward traceparent header to KV-tablet

* Introduced TWilsonGrpc::RequestActor
  • Loading branch information
domwst authored Dec 25, 2023
1 parent 6709bae commit 4d7dc0b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
10 changes: 8 additions & 2 deletions ydb/core/grpc_services/rpc_deferrable.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@
#include "cancelation/cancelation_event.h"
#include "rpc_common/rpc_common.h"

#include <ydb/core/tx/tx_proxy/proxy.h>
#include <ydb/library/ydb_issue/issue_helpers.h>
#include <ydb/core/base/tablet_pipe.h>
#include <ydb/core/protos/flat_tx_scheme.pb.h>
#include <ydb/core/tx/schemeshard/schemeshard.h>
#include <ydb/core/tx/tx_proxy/proxy.h>
#include <ydb/library/wilson_ids/wilson.h>
#include <ydb/library/ydb_issue/issue_helpers.h>
#include <ydb/public/api/protos/ydb_status_codes.pb.h>
#include <ydb/public/lib/operation_id/operation_id.h>

Expand Down Expand Up @@ -150,6 +151,8 @@ class TRpcOperationRequestActor : public TRpcRequestWithOperationParamsActor<TDe

TRpcOperationRequestActor(IRequestOpCtx* request)
: TBase(request)
, Span_(TWilsonGrpc::RequestActor, request->GetWilsonTraceId(),
"RequestProxy.RpcOperationRequestActor", NWilson::EFlags::AUTO_END)
{}

static constexpr NKikimrServices::TActivity::EType ActorActivityType() {
Expand Down Expand Up @@ -280,6 +283,9 @@ class TRpcOperationRequestActor : public TRpcRequestWithOperationParamsActor<TDe
auto as = TActivationContext::ActorSystem();
PassSubscription(ev->Get(), Request_.get(), as);
}

protected:
NWilson::TSpan Span_;
};

} // namespace NGRpcService
Expand Down
4 changes: 2 additions & 2 deletions ydb/core/grpc_services/rpc_keyvalue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,7 @@ class TBaseKeyValueRequest {
req->UserToken = UserToken;
req->DatabaseName = self->Request_->GetDatabaseName().GetOrElse("");
auto ev = new TEvTxProxySchemeCache::TEvNavigateKeySet(req.Release());
self->Send(MakeSchemeCacheID(), ev);
self->Send(MakeSchemeCacheID(), ev, 0, 0, self->Span_.GetTraceId());
}

bool OnNavigateKeySetResult(TEvTxProxySchemeCache::TEvNavigateKeySetResult::TPtr &ev, ui32 access) {
Expand Down Expand Up @@ -818,7 +818,7 @@ class TKeyValueRequestGrpc
auto &rec = *this->GetProtoRequest();
CopyProtobuf(rec, &req->Record);
req->Record.set_tablet_id(KVTabletId);
NTabletPipe::SendData(this->SelfId(), KVPipeClient, req.release(), 0);
NTabletPipe::SendData(this->SelfId(), KVPipeClient, req.release(), 0, TBase::Span_.GetTraceId());
}

void Handle(typename TKVRequest::TResponse::TPtr &ev) {
Expand Down
1 change: 1 addition & 0 deletions ydb/library/wilson_ids/wilson.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ namespace NKikimr {
struct TWilsonGrpc {
enum {
RequestProxy = 9,
RequestActor = 9,
};
};

Expand Down

0 comments on commit 4d7dc0b

Please sign in to comment.