Skip to content

Commit 44da537

Browse files
[+] Counter PQ/LatencyTxCalcPredicate #28149
1 parent 73e3251 commit 44da537

File tree

4 files changed

+10
-19
lines changed

4 files changed

+10
-19
lines changed

ydb/core/persqueue/partition.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1532,6 +1532,8 @@ void TPartition::Handle(TEvPQ::TEvGetWriteInfoError::TPtr& ev, const TActorConte
15321532
void TPartition::ReplyToProposeOrPredicate(TSimpleSharedPtr<TTransaction>& tx, bool isPredicate) {
15331533

15341534
if (isPredicate) {
1535+
TabletCounters.Percentile()[COUNTER_LATENCY_PQ_TXCALCPREDICATE].IncrementFor((Now() - tx->CalcPredicateTimestamp).MilliSeconds());
1536+
15351537
tx->CalcPredicateSpan.End();
15361538
tx->CalcPredicateSpan = {};
15371539

@@ -2044,7 +2046,7 @@ void TPartition::Handle(TEvKeyValue::TEvResponse::TPtr& ev, const TActorContext&
20442046

20452047
void TPartition::PushBackDistrTx(TSimpleSharedPtr<TEvPQ::TEvTxCalcPredicate> event)
20462048
{
2047-
UserActionAndTransactionEvents.emplace_back(MakeSimpleShared<TTransaction>(std::move(event)));
2049+
UserActionAndTransactionEvents.emplace_back(MakeSimpleShared<TTransaction>(std::move(event), Now()));
20482050
RequestWriteInfoIfRequired();
20492051
}
20502052

ydb/core/persqueue/partition.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,14 @@ class TPartitionCompaction;
6363

6464
struct TTransaction {
6565

66-
explicit TTransaction(TSimpleSharedPtr<TEvPQ::TEvTxCalcPredicate> tx,
67-
TMaybe<bool> predicate = Nothing())
66+
TTransaction(TSimpleSharedPtr<TEvPQ::TEvTxCalcPredicate> tx,
67+
TInstant calcPredicateTimestamp,
68+
TMaybe<bool> predicate = Nothing())
6869
: Tx(tx)
6970
, Predicate(predicate)
7071
, SupportivePartitionActor(tx->SupportivePartitionActor)
7172
, CalcPredicateSpan(std::move(tx->Span))
73+
, CalcPredicateTimestamp(calcPredicateTimestamp)
7274
{
7375
Y_ABORT_UNLESS(Tx);
7476
}
@@ -128,6 +130,7 @@ struct TTransaction {
128130
NWilson::TSpan CommitSpan;
129131

130132
TInstant WriteInfoResponseTimestamp;
133+
TInstant CalcPredicateTimestamp;
131134
};
132135
class TPartitionCompaction;
133136

ydb/core/persqueue/ut/partition_ut.cpp

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -281,11 +281,6 @@ class TPartitionFixture : public NUnitTest::TBaseFixture {
281281
void SendChangePartitionConfig(const TConfigParams& config = {});
282282
void WaitPartitionConfigChanged(const TChangePartitionConfigMatcher& matcher = {});
283283

284-
TTransaction MakeTransaction(ui64 step, ui64 txId,
285-
TString consumer,
286-
ui64 begin, ui64 end,
287-
TMaybe<bool> predicate = Nothing());
288-
289284
void SendSubDomainStatus(bool subDomainOutOfSpace = false);
290285
void SendReserveBytes(const ui64 cookie, const ui32 size, const TString& ownerCookie, const ui64 messageNo, bool lastRequest = false);
291286
void SendChangeOwner(const ui64 cookie, const TString& owner, const TActorId& pipeClient, const bool force = true);
@@ -1098,17 +1093,6 @@ void TPartitionFixture::WaitPartitionConfigChanged(const TChangePartitionConfigM
10981093
}
10991094
}
11001095

1101-
TTransaction TPartitionFixture::MakeTransaction(ui64 step, ui64 txId,
1102-
TString consumer,
1103-
ui64 begin, ui64 end,
1104-
TMaybe<bool> predicate)
1105-
{
1106-
auto event = MakeSimpleShared<TEvPQ::TEvTxCalcPredicate>(step, txId);
1107-
event->AddOperation(std::move(consumer), begin, end);
1108-
1109-
return TTransaction(event, predicate);
1110-
}
1111-
11121096
template<class TIterable>
11131097
void CompareVectors(const TVector<ui64>& expected, const TIterable& actual) {
11141098
auto i = 0u;

ydb/core/protos/counters_pq.proto

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,8 @@ enum EPercentileCounters {
141141
COUNTER_LATENCY_PQ_SPLIT_MESSAGE_GROUP = 19 [(CounterOpts) = {Name: "LatencySplitMessageGroup"}];
142142
COUNTER_LATENCY_PQ_PUBLISH_READ = 20 [(CounterOpts) = {Name: "LatencyPublishRead"}];
143143
COUNTER_LATENCY_PQ_FORGET_READ = 21 [(CounterOpts) = {Name: "LatencyForgetRead"}];
144+
145+
COUNTER_LATENCY_PQ_TXCALCPREDICATE = 22 [(CounterOpts) = {Name: "LatencyTxCalcPredicate"}];
144146
}
145147

146148

0 commit comments

Comments
 (0)