Skip to content

Commit d14ea3e

Browse files
authored
Merge 347cbdd into b58320e
2 parents b58320e + 347cbdd commit d14ea3e

File tree

2 files changed

+31
-4
lines changed

2 files changed

+31
-4
lines changed

ydb/core/load_test/group_write.cpp

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
#include <ydb/library/yverify_stream/yverify_stream.h>
88
#include <ydb/core/util/lz4_data_generator.h>
9+
#include <ydb/core/jaeger_tracing/throttler.h>
910

1011
#include <google/protobuf/text_format.h>
1112

@@ -445,6 +446,8 @@ class TLogWriterLoadTestActor : public TActorBootstrapped<TLogWriterLoadTestActo
445446
// There is no point in having more than 1 active garbage collection request at the moment
446447
constexpr static ui32 MaxGarbageCollectionsInFlight = 1;
447448

449+
std::shared_ptr<NJaegerTracing::TThrottler> TracingThrottler;
450+
448451
public:
449452
TTabletWriter(TIntrusivePtr<::NMonitoring::TDynamicCounters> counters,
450453
TLogWriterLoadTestActor& self, ui64 tabletId, ui32 channel,
@@ -453,7 +456,8 @@ class TLogWriterLoadTestActor : public TActorBootstrapped<TLogWriterLoadTestActo
453456
NKikimrBlobStorage::EGetHandleClass getHandleClass, const TRequestDispatchingSettings& readSettings,
454457
TIntervalGenerator garbageCollectIntervalGen,
455458
TDuration scriptedRoundDuration, TVector<TReqInfo>&& scriptedRequests,
456-
const TInitialAllocation& initialAllocation)
459+
const TInitialAllocation& initialAllocation,
460+
const std::shared_ptr<NJaegerTracing::TThrottler>& tracingThrottler)
457461
: Self(self)
458462
, TagCounters(counters->GetSubgroup("tag", Sprintf("%" PRIu64, Self.Tag)))
459463
, Counters(TagCounters->GetSubgroup("channel", Sprintf("%" PRIu32, channel)))
@@ -491,6 +495,7 @@ class TLogWriterLoadTestActor : public TActorBootstrapped<TLogWriterLoadTestActo
491495
, ScriptedRequests(std::move(scriptedRequests))
492496
, InitialAllocation(initialAllocation)
493497
, GarbageCollectIntervalGen(garbageCollectIntervalGen)
498+
, TracingThrottler(tracingThrottler)
494499
{
495500
*Counters->GetCounter("tabletId") = tabletId;
496501
const auto& percCounters = Counters->GetSubgroup("sensor", "microseconds");
@@ -923,7 +928,13 @@ class TLogWriterLoadTestActor : public TActorBootstrapped<TLogWriterLoadTestActo
923928
IssueReadIfPossible(ctx);
924929
}
925930
};
926-
SendToBSProxy(ctx, GroupId, ev.release(), Self.QueryDispatcher.ObtainCookie(std::move(writeCallback)));
931+
932+
NWilson::TTraceId traceId = (TracingThrottler && !TracingThrottler->Throttle())
933+
? NWilson::TTraceId::NewTraceId(15, ::Max<ui32>())
934+
: NWilson::TTraceId{};
935+
936+
SendToBSProxy(ctx, GroupId, ev.release(), Self.QueryDispatcher.ObtainCookie(std::move(writeCallback)),
937+
std::move(traceId));
927938
const auto nowCycles = GetCycleCountFast();
928939
WritesInFlightTimestamps.emplace_back(writeQueryId, nowCycles);
929940
SentTimestamp.emplace(writeQueryId, nowCycles);
@@ -1073,7 +1084,12 @@ class TLogWriterLoadTestActor : public TActorBootstrapped<TLogWriterLoadTestActo
10731084
IssueReadIfPossible(ctx);
10741085
};
10751086

1076-
SendToBSProxy(ctx, GroupId, ev.release(), Self.QueryDispatcher.ObtainCookie(std::move(readCallback)));
1087+
NWilson::TTraceId traceId = (TracingThrottler && !TracingThrottler->Throttle())
1088+
? NWilson::TTraceId::NewTraceId(15, ::Max<ui32>())
1089+
: NWilson::TTraceId{};
1090+
1091+
SendToBSProxy(ctx, GroupId, ev.release(), Self.QueryDispatcher.ObtainCookie(std::move(readCallback)),
1092+
std::move(traceId));
10771093
ReadSentTimestamp.emplace(readQueryId, GetCycleCountFast());
10781094

10791095
ReadSettings.InFlightTracker.Request(size);
@@ -1211,6 +1227,14 @@ class TLogWriterLoadTestActor : public TActorBootstrapped<TLogWriterLoadTestActo
12111227

12121228
TIntervalGenerator garbageCollectIntervalGen(profile.GetFlushIntervals());
12131229

1230+
std::shared_ptr<NJaegerTracing::TThrottler> tracingThrottler;
1231+
1232+
ui32 throttlerRate = profile.GetTracingThrottlerRate();
1233+
if (throttlerRate) {
1234+
tracingThrottler.reset(new NJaegerTracing::TThrottler(throttlerRate, profile.GetTracingThrottlerBurst(),
1235+
TAppData::TimeProvider));
1236+
}
1237+
12141238
for (const auto& tablet : profile.GetTablets()) {
12151239
auto scriptedRoundDuration = TDuration::MicroSeconds(tablet.GetScriptedCycleDurationSec() * 1e6);
12161240
TVector<TReqInfo> scriptedRequests;
@@ -1256,7 +1280,7 @@ class TLogWriterLoadTestActor : public TActorBootstrapped<TLogWriterLoadTestActo
12561280
getHandleClass, readSettings,
12571281
garbageCollectIntervalGen,
12581282
scriptedRoundDuration, std::move(scriptedRequests),
1259-
initialAllocation));
1283+
initialAllocation, tracingThrottler));
12601284

12611285
WorkersInInitialState++;
12621286
}

ydb/core/protos/load_test.proto

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,9 @@ message TEvLoadTestRequest {
8686
optional THardRateDispatcherInfo ReadHardRateDispatcher = 16;
8787

8888
optional TInitialBlobAllocation InitialAllocation = 17;
89+
90+
optional uint32 TracingThrottlerRate = 18 [default = 0];
91+
optional uint32 TracingThrottlerBurst = 19 [default = 0];
8992
};
9093
optional uint64 Tag = 1;
9194
optional uint32 DurationSeconds = 2;

0 commit comments

Comments
 (0)