Skip to content

Commit fcdfa43

Browse files
zarinatlupovaGazizonoki
authored andcommitted
[C++ SDK] Add traceparent to TRequestSettings (#17561)
1 parent ac206ef commit fcdfa43

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

include/ydb-cpp-sdk/client/types/request_settings.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
#include <vector>
1010
#include <utility>
11+
#include <string>
1112

1213
namespace NYdb::inline V3 {
1314

@@ -20,6 +21,7 @@ struct TRequestSettings {
2021
FLUENT_SETTING(std::string, RequestType);
2122
FLUENT_SETTING(THeader, Header);
2223
FLUENT_SETTING(TDuration, ClientTimeout);
24+
FLUENT_SETTING(std::string, TraceParent);
2325

2426
TRequestSettings() = default;
2527

@@ -29,6 +31,7 @@ struct TRequestSettings {
2931
, RequestType_(other.RequestType_)
3032
, Header_(other.Header_)
3133
, ClientTimeout_(other.ClientTimeout_)
34+
, TraceParent_(other.TraceParent_)
3235
{}
3336
};
3437

src/client/impl/ydb_internal/rpc_request_settings/settings.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@ struct TRpcRequestSettings {
2424
rpcSettings.TraceId = settings.TraceId_;
2525
rpcSettings.RequestType = settings.RequestType_;
2626
rpcSettings.Header = settings.Header_;
27+
28+
if (!settings.TraceParent_.empty()) {
29+
rpcSettings.Header.emplace_back("traceparent", settings.TraceParent_);
30+
}
31+
2732
rpcSettings.PreferredEndpoint = preferredEndpoint;
2833
rpcSettings.EndpointPolicy = endpointPolicy;
2934
rpcSettings.UseAuth = true;

0 commit comments

Comments
 (0)