Skip to content

Conversation

durkmurder
Copy link
Member

@durkmurder durkmurder commented Oct 10, 2025

#7931

Context

This PR adds reporting of metrics related to the block construction process. Specifically it reports actual collection size and number of prioritized transactions for each created cluster block. The metric is reported during block building process, by each leader.

This will be used to add a panel which shows ratio of prioritized transactions to all transactions.

…n. Added implemention for metrics and integrated them in block building process
@codecov-commenter
Copy link

codecov-commenter commented Oct 10, 2025

Codecov Report

❌ Patch coverage is 12.19512% with 36 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
module/metrics/collection.go 0.00% 28 Missing ⚠️
module/builder/collection/builder.go 55.55% 4 Missing ⚠️
module/mock/collection_metrics.go 0.00% 3 Missing ⚠️
module/metrics/noop.go 0.00% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

Copy link
Member

@jordanschalm jordanschalm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Main piece of feedback is to consolidate the new metric with the existing ClusterBlockProposed

Comment on lines 67 to 73
collectionSize: promauto.NewHistogramVec(prometheus.HistogramOpts{
Namespace: namespaceCollection,
Subsystem: subsystemProposal,
Buckets: []float64{1, 2, 5, 10, 20},
Name: "collection_size",
Help: "number of transactions included in the block",
}, []string{LabelChain}),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we already have a metric defined that is equivalent to this, but it isn't being used anywhere (proposals). Can we use that instead of adding a new metric?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The thing is that I report the facft that proposal has been created, the other metric, the old one, states about block being "proposed". That is the reason I have introduced a new metric, since proposing technically happens when we broadcast it over the network I didn't want to have confusing naming. And actually reporting those values at the point where we broadcast it requires us to carry additional information across modules(number of priority transactions).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I get that, but the existing one is not being used. My main point is, let's just keep one of these nearly identical metrics (whether the existing one, or your new one) and update the documentation to match the context in which you are using it.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've removed the old one and replaced it with new one, I think the naming is better and represents the purpose better.
7ad5f51

return nil, fmt.Errorf("could not build cluster block: %w", err)
}

b.metrics.ClusterBlockCreated(block, priorityTransactionsCount)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you tried making a panel that visualizes this yet? Most of our metrics are uniform across all nodes (each node reports approximately the same metric values, and we can average across them). For this one we will need to sum across all nodes (and this will exclude partner-run and Dapper-run nodes) to get a full picture, since each node is only reporting on blocks it is building.

It will definitely give us some useful information, we just need to be careful when interpreting it.

Copy link
Member

@AlexHentschel AlexHentschel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clear and clean. Nice work.

@durkmurder durkmurder enabled auto-merge October 15, 2025 08:03
@durkmurder durkmurder added this pull request to the merge queue Oct 15, 2025
Merged via the queue into master with commit 4e9b1c5 Oct 15, 2025
57 checks passed
@durkmurder durkmurder deleted the yurii/7391-extend-collection-building-metrics branch October 15, 2025 09:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants