Skip to content

Commit 24a78db

Browse files
committed
Add pre validation time and validation time for block events
1 parent 2abbf72 commit 24a78db

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

internal/metrics/fullnode.go

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,12 @@ type FullNodeServiceMetrics struct {
4141
connectionCount *prometheus.GaugeVec
4242

4343
// Block Metrics
44-
maxBlockCost *wrappedPrometheus.LazyGauge
45-
blockCost *wrappedPrometheus.LazyGauge
46-
blockFees *wrappedPrometheus.LazyGauge
47-
kSize *prometheus.CounterVec
44+
maxBlockCost *wrappedPrometheus.LazyGauge
45+
blockCost *wrappedPrometheus.LazyGauge
46+
blockFees *wrappedPrometheus.LazyGauge
47+
kSize *prometheus.CounterVec
48+
preValidationTime *wrappedPrometheus.LazyGauge
49+
validationTime *wrappedPrometheus.LazyGauge
4850

4951
// Signage Point Metrics
5052
totalSignagePoints *wrappedPrometheus.LazyCounter
@@ -78,6 +80,8 @@ func (s *FullNodeServiceMetrics) InitMetrics() {
7880
s.blockCost = s.metrics.newGauge(chiaServiceFullNode, "block_cost", "Total cost of all transactions in the last block")
7981
s.blockFees = s.metrics.newGauge(chiaServiceFullNode, "block_fees", "Total fees in the last block")
8082
s.kSize = s.metrics.newCounterVec(chiaServiceFullNode, "k_size", "Counts of winning plot size since the exporter was last started", []string{"size"})
83+
s.preValidationTime = s.metrics.newGauge(chiaServiceFullNode, "pre_validation_time", "Last pre_validation_time from the block event")
84+
s.validationTime = s.metrics.newGauge(chiaServiceFullNode, "validation_time", "Last validation time from the block event")
8185

8286
s.totalSignagePoints = s.metrics.newCounter(chiaServiceFullNode, "total_signage_points", "Total number of signage points since the metrics exporter started. Only useful when combined with rate() or similar")
8387
s.signagePointsSubSlot = s.metrics.newGauge(chiaServiceFullNode, "signage_points_sub_slot", "Number of signage points per sub slot")
@@ -234,6 +238,8 @@ func (s *FullNodeServiceMetrics) Block(resp *types.WebsocketResponse) {
234238
}
235239

236240
s.kSize.WithLabelValues(fmt.Sprintf("%d", block.KSize)).Inc()
241+
s.preValidationTime.Set(block.PreValidationTime)
242+
s.validationTime.Set(block.ValidationTime)
237243

238244
if block.TransactionBlock {
239245
s.blockCost.Set(float64(block.BlockCost))

0 commit comments

Comments
 (0)