Skip to content

Commit

Permalink
Emit blocktime as quantile
Browse files Browse the repository at this point in the history
  • Loading branch information
teddyding committed Jul 16, 2024
1 parent b5a530e commit cfcf8de
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions protocol/lib/metrics/metric_keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ const (
LiquidationsPercentFilledDistribution = "liquidations_percent_filled_distribution"
LiquidationsPlacePerpetualLiquidationQuoteQuantumsDistribution = "liquidations_place_perpetual_liquidation_quote_quantums_distribution"
RateLimitWithdrawalAmount = "rate_limit_withdrawal_amount"
BlockTimeDistribution = "block_time_dist"

// Measure Since
ClobOffsettingSubaccountPerpetualPosition = "clob_offsetting_subaccount_perpetual_position"
Expand Down
9 changes: 9 additions & 0 deletions protocol/x/blocktime/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,15 @@ func (k Keeper) UpdateAllDowntimeInfo(ctx sdk.Context) {
metrics.BlockTimeMs,
)

metrics.AddSampleWithLabels(
metrics.BlockTimeDistribution,
float32(delta.Milliseconds()),
metrics.GetLabelForStringValue(
metrics.Proposer,
sdk.ConsAddress(ctx.BlockHeader().ProposerAddress).String(),
),
)

allInfo := k.GetAllDowntimeInfo(ctx)

for _, info := range allInfo.Infos {
Expand Down

0 comments on commit cfcf8de

Please sign in to comment.