Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a transaction block counter #135

Merged
merged 1 commit into from
Feb 9, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions internal/metrics/fullnode.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,13 @@ type FullNodeServiceMetrics struct {
connectionCount *prometheus.GaugeVec

// Block Metrics
maxBlockCost *wrappedPrometheus.LazyGauge
blockCost *wrappedPrometheus.LazyGauge
blockFees *wrappedPrometheus.LazyGauge
kSize *prometheus.CounterVec
preValidationTime *wrappedPrometheus.LazyGauge
validationTime *wrappedPrometheus.LazyGauge
maxBlockCost *wrappedPrometheus.LazyGauge
blockCost *wrappedPrometheus.LazyGauge
blockFees *wrappedPrometheus.LazyGauge
kSize *prometheus.CounterVec
preValidationTime *wrappedPrometheus.LazyGauge
validationTime *wrappedPrometheus.LazyGauge
transactionBlockCounter *wrappedPrometheus.LazyCounter

// Signage Point Metrics
totalSignagePoints *wrappedPrometheus.LazyCounter
Expand Down Expand Up @@ -115,13 +116,14 @@ func (s *FullNodeServiceMetrics) InitMetrics() {
// Connection Metrics
s.connectionCount = s.metrics.newGaugeVec(chiaServiceFullNode, "connection_count", "Number of active connections for each type of peer", []string{"node_type"})

// Unfinished Block Metrics
// Block Metrics
s.maxBlockCost = s.metrics.newGauge(chiaServiceFullNode, "block_max_cost", "Max block size, in cost")
s.blockCost = s.metrics.newGauge(chiaServiceFullNode, "block_cost", "Total cost of all transactions in the last block")
s.blockFees = s.metrics.newGauge(chiaServiceFullNode, "block_fees", "Total fees in the last block")
s.kSize = s.metrics.newCounterVec(chiaServiceFullNode, "k_size", "Counts of winning plot size since the exporter was last started", []string{"size"})
s.preValidationTime = s.metrics.newGauge(chiaServiceFullNode, "pre_validation_time", "Last pre_validation_time from the block event")
s.validationTime = s.metrics.newGauge(chiaServiceFullNode, "validation_time", "Last validation time from the block event")
s.transactionBlockCounter = s.metrics.newCounter(chiaServiceFullNode, "transaction_blocks", "Number of transaction blocks seen since the exporter has started")

// Signage Point Metrics
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")
Expand Down Expand Up @@ -361,6 +363,7 @@ func (s *FullNodeServiceMetrics) Block(resp *types.WebsocketResponse) {
if block.TransactionBlock {
s.blockCost.Set(float64(block.BlockCost.OrEmpty()))
s.blockFees.Set(float64(block.BlockFees.OrEmpty()))
s.transactionBlockCounter.Add(1)
}
}

Expand Down
Loading