Skip to content

Commit 2250022

Browse files
replay: adding reasm tracking metrics
1 parent da1aa8c commit 2250022

File tree

5 files changed

+56
-16
lines changed

5 files changed

+56
-16
lines changed

book/api/metrics-generated.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -526,6 +526,9 @@
526526
| <span class="metrics-name">replay_&#8203;reset_&#8203;slot</span> | gauge | The slot at which we last reset the replay stage, or 0 if unknown |
527527
| <span class="metrics-name">replay_&#8203;max_&#8203;live_&#8203;banks</span> | gauge | The maximum number of banks we can have alive |
528528
| <span class="metrics-name">replay_&#8203;live_&#8203;banks</span> | gauge | The number of banks we currently have alive |
529+
| <span class="metrics-name">replay_&#8203;reasm_&#8203;free</span> | gauge | The number of free FEC sets in the reassembly queue |
530+
| <span class="metrics-name">replay_&#8203;reasm_&#8203;latest_&#8203;slot</span> | gauge | Slot of the latest FEC set in the reassembly queue that can be replayed |
531+
| <span class="metrics-name">replay_&#8203;reasm_&#8203;latest_&#8203;fec_&#8203;idx</span> | gauge | FEC set index of the latest FEC set in the reassembly queue that can be replayed |
529532
| <span class="metrics-name">replay_&#8203;slots_&#8203;total</span> | counter | Count of slots replayed successfully |
530533
| <span class="metrics-name">replay_&#8203;transactions_&#8203;total</span> | counter | Count of transactions processed overall on the current fork |
531534
| <span class="metrics-name">replay_&#8203;sched_&#8203;full</span> | counter | Times where sched is full and a FEC set can't be processed |

src/disco/metrics/generated/fd_metrics_replay.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ const fd_metrics_meta_t FD_METRICS_REPLAY[FD_METRICS_REPLAY_TOTAL] = {
1515
DECLARE_METRIC( REPLAY_RESET_SLOT, GAUGE ),
1616
DECLARE_METRIC( REPLAY_MAX_LIVE_BANKS, GAUGE ),
1717
DECLARE_METRIC( REPLAY_LIVE_BANKS, GAUGE ),
18+
DECLARE_METRIC( REPLAY_REASM_FREE, GAUGE ),
19+
DECLARE_METRIC( REPLAY_REASM_LATEST_SLOT, GAUGE ),
20+
DECLARE_METRIC( REPLAY_REASM_LATEST_FEC_IDX, GAUGE ),
1821
DECLARE_METRIC( REPLAY_SLOTS_TOTAL, COUNTER ),
1922
DECLARE_METRIC( REPLAY_TRANSACTIONS_TOTAL, COUNTER ),
2023
DECLARE_METRIC( REPLAY_SCHED_FULL, COUNTER ),

src/disco/metrics/generated/fd_metrics_replay.h

Lines changed: 29 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -96,67 +96,85 @@
9696
#define FD_METRICS_GAUGE_REPLAY_LIVE_BANKS_DESC "The number of banks we currently have alive"
9797
#define FD_METRICS_GAUGE_REPLAY_LIVE_BANKS_CVT (FD_METRICS_CONVERTER_NONE)
9898

99-
#define FD_METRICS_COUNTER_REPLAY_SLOTS_TOTAL_OFF (125UL)
99+
#define FD_METRICS_GAUGE_REPLAY_REASM_FREE_OFF (125UL)
100+
#define FD_METRICS_GAUGE_REPLAY_REASM_FREE_NAME "replay_reasm_free"
101+
#define FD_METRICS_GAUGE_REPLAY_REASM_FREE_TYPE (FD_METRICS_TYPE_GAUGE)
102+
#define FD_METRICS_GAUGE_REPLAY_REASM_FREE_DESC "The number of free FEC sets in the reassembly queue"
103+
#define FD_METRICS_GAUGE_REPLAY_REASM_FREE_CVT (FD_METRICS_CONVERTER_NONE)
104+
105+
#define FD_METRICS_GAUGE_REPLAY_REASM_LATEST_SLOT_OFF (126UL)
106+
#define FD_METRICS_GAUGE_REPLAY_REASM_LATEST_SLOT_NAME "replay_reasm_latest_slot"
107+
#define FD_METRICS_GAUGE_REPLAY_REASM_LATEST_SLOT_TYPE (FD_METRICS_TYPE_GAUGE)
108+
#define FD_METRICS_GAUGE_REPLAY_REASM_LATEST_SLOT_DESC "Slot of the latest FEC set in the reassembly queue that can be replayed"
109+
#define FD_METRICS_GAUGE_REPLAY_REASM_LATEST_SLOT_CVT (FD_METRICS_CONVERTER_NONE)
110+
111+
#define FD_METRICS_GAUGE_REPLAY_REASM_LATEST_FEC_IDX_OFF (127UL)
112+
#define FD_METRICS_GAUGE_REPLAY_REASM_LATEST_FEC_IDX_NAME "replay_reasm_latest_fec_idx"
113+
#define FD_METRICS_GAUGE_REPLAY_REASM_LATEST_FEC_IDX_TYPE (FD_METRICS_TYPE_GAUGE)
114+
#define FD_METRICS_GAUGE_REPLAY_REASM_LATEST_FEC_IDX_DESC "FEC set index of the latest FEC set in the reassembly queue that can be replayed"
115+
#define FD_METRICS_GAUGE_REPLAY_REASM_LATEST_FEC_IDX_CVT (FD_METRICS_CONVERTER_NONE)
116+
117+
#define FD_METRICS_COUNTER_REPLAY_SLOTS_TOTAL_OFF (128UL)
100118
#define FD_METRICS_COUNTER_REPLAY_SLOTS_TOTAL_NAME "replay_slots_total"
101119
#define FD_METRICS_COUNTER_REPLAY_SLOTS_TOTAL_TYPE (FD_METRICS_TYPE_COUNTER)
102120
#define FD_METRICS_COUNTER_REPLAY_SLOTS_TOTAL_DESC "Count of slots replayed successfully"
103121
#define FD_METRICS_COUNTER_REPLAY_SLOTS_TOTAL_CVT (FD_METRICS_CONVERTER_NONE)
104122

105-
#define FD_METRICS_COUNTER_REPLAY_TRANSACTIONS_TOTAL_OFF (126UL)
123+
#define FD_METRICS_COUNTER_REPLAY_TRANSACTIONS_TOTAL_OFF (129UL)
106124
#define FD_METRICS_COUNTER_REPLAY_TRANSACTIONS_TOTAL_NAME "replay_transactions_total"
107125
#define FD_METRICS_COUNTER_REPLAY_TRANSACTIONS_TOTAL_TYPE (FD_METRICS_TYPE_COUNTER)
108126
#define FD_METRICS_COUNTER_REPLAY_TRANSACTIONS_TOTAL_DESC "Count of transactions processed overall on the current fork"
109127
#define FD_METRICS_COUNTER_REPLAY_TRANSACTIONS_TOTAL_CVT (FD_METRICS_CONVERTER_NONE)
110128

111-
#define FD_METRICS_COUNTER_REPLAY_SCHED_FULL_OFF (127UL)
129+
#define FD_METRICS_COUNTER_REPLAY_SCHED_FULL_OFF (130UL)
112130
#define FD_METRICS_COUNTER_REPLAY_SCHED_FULL_NAME "replay_sched_full"
113131
#define FD_METRICS_COUNTER_REPLAY_SCHED_FULL_TYPE (FD_METRICS_TYPE_COUNTER)
114132
#define FD_METRICS_COUNTER_REPLAY_SCHED_FULL_DESC "Times where sched is full and a FEC set can't be processed"
115133
#define FD_METRICS_COUNTER_REPLAY_SCHED_FULL_CVT (FD_METRICS_CONVERTER_NONE)
116134

117-
#define FD_METRICS_COUNTER_REPLAY_REASM_EMPTY_OFF (128UL)
135+
#define FD_METRICS_COUNTER_REPLAY_REASM_EMPTY_OFF (131UL)
118136
#define FD_METRICS_COUNTER_REPLAY_REASM_EMPTY_NAME "replay_reasm_empty"
119137
#define FD_METRICS_COUNTER_REPLAY_REASM_EMPTY_TYPE (FD_METRICS_TYPE_COUNTER)
120138
#define FD_METRICS_COUNTER_REPLAY_REASM_EMPTY_DESC "Times where reasm is empty and a FEC set can't be processed"
121139
#define FD_METRICS_COUNTER_REPLAY_REASM_EMPTY_CVT (FD_METRICS_CONVERTER_NONE)
122140

123-
#define FD_METRICS_COUNTER_REPLAY_LEADER_BID_WAIT_OFF (129UL)
141+
#define FD_METRICS_COUNTER_REPLAY_LEADER_BID_WAIT_OFF (132UL)
124142
#define FD_METRICS_COUNTER_REPLAY_LEADER_BID_WAIT_NAME "replay_leader_bid_wait"
125143
#define FD_METRICS_COUNTER_REPLAY_LEADER_BID_WAIT_TYPE (FD_METRICS_TYPE_COUNTER)
126144
#define FD_METRICS_COUNTER_REPLAY_LEADER_BID_WAIT_DESC "Times where replay is blocked by the the PoH tile not sending an end of leader message"
127145
#define FD_METRICS_COUNTER_REPLAY_LEADER_BID_WAIT_CVT (FD_METRICS_CONVERTER_NONE)
128146

129-
#define FD_METRICS_COUNTER_REPLAY_BANKS_FULL_OFF (130UL)
147+
#define FD_METRICS_COUNTER_REPLAY_BANKS_FULL_OFF (133UL)
130148
#define FD_METRICS_COUNTER_REPLAY_BANKS_FULL_NAME "replay_banks_full"
131149
#define FD_METRICS_COUNTER_REPLAY_BANKS_FULL_TYPE (FD_METRICS_TYPE_COUNTER)
132150
#define FD_METRICS_COUNTER_REPLAY_BANKS_FULL_DESC "Times where banks are full and a FEC set can't be processed"
133151
#define FD_METRICS_COUNTER_REPLAY_BANKS_FULL_CVT (FD_METRICS_CONVERTER_NONE)
134152

135-
#define FD_METRICS_COUNTER_REPLAY_PROGCACHE_ROOTED_OFF (131UL)
153+
#define FD_METRICS_COUNTER_REPLAY_PROGCACHE_ROOTED_OFF (134UL)
136154
#define FD_METRICS_COUNTER_REPLAY_PROGCACHE_ROOTED_NAME "replay_progcache_rooted"
137155
#define FD_METRICS_COUNTER_REPLAY_PROGCACHE_ROOTED_TYPE (FD_METRICS_TYPE_COUNTER)
138156
#define FD_METRICS_COUNTER_REPLAY_PROGCACHE_ROOTED_DESC "Number of program cache entries rooted"
139157
#define FD_METRICS_COUNTER_REPLAY_PROGCACHE_ROOTED_CVT (FD_METRICS_CONVERTER_NONE)
140158

141-
#define FD_METRICS_COUNTER_REPLAY_PROGCACHE_GC_ROOT_OFF (132UL)
159+
#define FD_METRICS_COUNTER_REPLAY_PROGCACHE_GC_ROOT_OFF (135UL)
142160
#define FD_METRICS_COUNTER_REPLAY_PROGCACHE_GC_ROOT_NAME "replay_progcache_gc_root"
143161
#define FD_METRICS_COUNTER_REPLAY_PROGCACHE_GC_ROOT_TYPE (FD_METRICS_TYPE_COUNTER)
144162
#define FD_METRICS_COUNTER_REPLAY_PROGCACHE_GC_ROOT_DESC "Number of program cache entries garbage collected while rooting"
145163
#define FD_METRICS_COUNTER_REPLAY_PROGCACHE_GC_ROOT_CVT (FD_METRICS_CONVERTER_NONE)
146164

147-
#define FD_METRICS_COUNTER_REPLAY_ACCDB_ROOTED_OFF (133UL)
165+
#define FD_METRICS_COUNTER_REPLAY_ACCDB_ROOTED_OFF (136UL)
148166
#define FD_METRICS_COUNTER_REPLAY_ACCDB_ROOTED_NAME "replay_accdb_rooted"
149167
#define FD_METRICS_COUNTER_REPLAY_ACCDB_ROOTED_TYPE (FD_METRICS_TYPE_COUNTER)
150168
#define FD_METRICS_COUNTER_REPLAY_ACCDB_ROOTED_DESC "Number of account database entries rooted"
151169
#define FD_METRICS_COUNTER_REPLAY_ACCDB_ROOTED_CVT (FD_METRICS_CONVERTER_NONE)
152170

153-
#define FD_METRICS_COUNTER_REPLAY_ACCDB_GC_ROOT_OFF (134UL)
171+
#define FD_METRICS_COUNTER_REPLAY_ACCDB_GC_ROOT_OFF (137UL)
154172
#define FD_METRICS_COUNTER_REPLAY_ACCDB_GC_ROOT_NAME "replay_accdb_gc_root"
155173
#define FD_METRICS_COUNTER_REPLAY_ACCDB_GC_ROOT_TYPE (FD_METRICS_TYPE_COUNTER)
156174
#define FD_METRICS_COUNTER_REPLAY_ACCDB_GC_ROOT_DESC "Number of account database entries garbage collected"
157175
#define FD_METRICS_COUNTER_REPLAY_ACCDB_GC_ROOT_CVT (FD_METRICS_CONVERTER_NONE)
158176

159-
#define FD_METRICS_REPLAY_TOTAL (23UL)
177+
#define FD_METRICS_REPLAY_TOTAL (26UL)
160178
extern const fd_metrics_meta_t FD_METRICS_REPLAY[FD_METRICS_REPLAY_TOTAL];
161179

162180
#endif /* HEADER_fd_src_disco_metrics_generated_fd_metrics_replay_h */

src/disco/metrics/metrics.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -794,6 +794,10 @@ metric introduced.
794794
<gauge name="MaxLiveBanks" summary="The maximum number of banks we can have alive" />
795795
<gauge name="LiveBanks" summary="The number of banks we currently have alive" />
796796

797+
<gauge name="ReasmFree" summary="The number of free FEC sets in the reassembly queue" />
798+
<gauge name="ReasmLatestSlot" summary="Slot of the latest FEC set in the reassembly queue that can be replayed" />
799+
<gauge name="ReasmLatestFecIdx" summary="FEC set index of the latest FEC set in the reassembly queue that can be replayed" />
800+
797801
<counter name="SlotsTotal" summary="Count of slots replayed successfully" />
798802
<counter name="TransactionsTotal" summary="Count of transactions processed overall on the current fork" />
799803

src/discof/replay/fd_replay_tile.c

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,9 @@ struct fd_replay_tile {
407407
ulong slots_total;
408408
ulong transactions_total;
409409

410+
ulong reasm_latest_slot;
411+
ulong reasm_latest_fec_idx;
412+
410413
ulong sched_full;
411414
ulong reasm_empty;
412415
ulong leader_bid_wait;
@@ -475,13 +478,19 @@ metrics_write( fd_replay_tile_t * ctx ) {
475478
ulong live_banks = fd_banks_pool_max( bank_pool ) - fd_banks_pool_free( bank_pool );
476479
FD_MGAUGE_SET( REPLAY, LIVE_BANKS, live_banks );
477480

481+
ulong reasm_free = fd_reasm_free( ctx->reasm );
482+
FD_MGAUGE_SET( REPLAY, REASM_FREE, reasm_free );
483+
478484
FD_MCNT_SET( REPLAY, SLOTS_TOTAL, ctx->metrics.slots_total );
479485
FD_MCNT_SET( REPLAY, TRANSACTIONS_TOTAL, ctx->metrics.transactions_total );
480486

481-
FD_MCNT_SET( REPLAY, SCHED_FULL, ctx->metrics.sched_full );
482-
FD_MCNT_SET( REPLAY, REASM_EMPTY, ctx->metrics.reasm_empty );
487+
FD_MGAUGE_SET( REPLAY, REASM_LATEST_SLOT, ctx->metrics.reasm_latest_slot );
488+
FD_MGAUGE_SET( REPLAY, REASM_LATEST_FEC_IDX, ctx->metrics.reasm_latest_fec_idx );
489+
490+
FD_MCNT_SET( REPLAY, SCHED_FULL, ctx->metrics.sched_full );
491+
FD_MCNT_SET( REPLAY, REASM_EMPTY, ctx->metrics.reasm_empty );
483492
FD_MCNT_SET( REPLAY, LEADER_BID_WAIT, ctx->metrics.leader_bid_wait );
484-
FD_MCNT_SET( REPLAY, BANKS_FULL, ctx->metrics.banks_full );
493+
FD_MCNT_SET( REPLAY, BANKS_FULL, ctx->metrics.banks_full );
485494

486495
FD_MCNT_SET( REPLAY, PROGCACHE_ROOTED, ctx->progcache_admin->metrics.root_cnt );
487496
FD_MCNT_SET( REPLAY, PROGCACHE_GC_ROOT, ctx->progcache_admin->metrics.gc_root_cnt );
@@ -1617,9 +1626,14 @@ can_process_fec( fd_replay_tile_t * ctx ) {
16171626

16181627
if( FD_UNLIKELY( (fec = fd_reasm_peek( ctx->reasm ))==NULL ) ) {
16191628
ctx->metrics.reasm_empty++;
1629+
ctx->metrics.reasm_latest_slot = ULONG_MAX;
1630+
ctx->metrics.reasm_latest_fec_idx = ULONG_MAX;
16201631
return 0;
16211632
}
16221633

1634+
ctx->metrics.reasm_latest_slot = fec->slot;
1635+
ctx->metrics.reasm_latest_fec_idx = fec->fec_set_idx;
1636+
16231637
if( FD_UNLIKELY( ctx->is_leader && fec->fec_set_idx==0U && fd_reasm_parent( ctx->reasm, fec )->bank_idx==ctx->leader_bank->idx ) ) {
16241638
/* There's a race that's exceedingly rare, where we receive the
16251639
FEC set for the slot right after our leader rotation before we
@@ -1918,8 +1932,6 @@ after_credit( fd_replay_tile_t * ctx,
19181932
*charge_busy = 1;
19191933
*opt_poll_in = 0;
19201934
return;
1921-
} else {
1922-
19231935
}
19241936

19251937
*charge_busy = replay( ctx, stem );

0 commit comments

Comments
 (0)