@@ -15,8 +15,9 @@ type CollectionCollector struct {
1515 transactionsIngested prometheus.Counter // tracks the number of ingested transactions
1616 finalizedHeight * prometheus.GaugeVec // tracks the finalized height
1717 maxCollectionSize prometheus.Gauge // tracks the maximum collection size
18- proposals * prometheus.HistogramVec // tracks the number/size of PROPOSED collections
1918 guarantees * prometheus.HistogramVec // counts the number/size of FINALIZED collections
19+ collectionSize * prometheus.HistogramVec // number of transactions included ONLY in the cluster blocks proposed by this node
20+ priorityTxns * prometheus.HistogramVec // number of priority transactions included ONLY in cluster blocks proposed by this node
2021}
2122
2223var _ module.CollectionMetrics = (* CollectionCollector )(nil )
@@ -46,20 +47,28 @@ func NewCollectionCollector(tracer module.Tracer) *CollectionCollector {
4647 Help : "last used max collection size" ,
4748 }),
4849
49- proposals : promauto .NewHistogramVec (prometheus.HistogramOpts {
50+ guarantees : promauto .NewHistogramVec (prometheus.HistogramOpts {
5051 Namespace : namespaceCollection ,
5152 Subsystem : subsystemProposal ,
5253 Buckets : []float64 {1 , 2 , 5 , 10 , 20 },
53- Name : "proposals_size_transactions " ,
54- Help : "size/number of proposed collections" ,
54+ Name : "guarantees_size_transactions " ,
55+ Help : "size/number of guaranteed/finalized collections" ,
5556 }, []string {LabelChain }),
5657
57- guarantees : promauto .NewHistogramVec (prometheus.HistogramOpts {
58+ collectionSize : promauto .NewHistogramVec (prometheus.HistogramOpts {
5859 Namespace : namespaceCollection ,
5960 Subsystem : subsystemProposal ,
6061 Buckets : []float64 {1 , 2 , 5 , 10 , 20 },
61- Name : "guarantees_size_transactions" ,
62- Help : "size/number of guaranteed/finalized collections" ,
62+ Name : "collection_size" ,
63+ Help : "number of transactions included ONLY in the cluster blocks proposed by this node" ,
64+ }, []string {LabelChain }),
65+
66+ priorityTxns : promauto .NewHistogramVec (prometheus.HistogramOpts {
67+ Namespace : namespaceCollection ,
68+ Subsystem : subsystemProposal ,
69+ Buckets : []float64 {1 , 2 , 5 , 10 , 20 },
70+ Name : "priority_transactions" ,
71+ Help : "number of priority transactions included ONLY in cluster blocks proposed by this node" ,
6372 }, []string {LabelChain }),
6473 }
6574
@@ -72,33 +81,38 @@ func (cc *CollectionCollector) TransactionIngested(txID flow.Identifier) {
7281 cc .transactionsIngested .Inc ()
7382}
7483
75- // ClusterBlockProposed tracks the size and number of proposals, as well as
76- // starting the collection->guarantee span.
77- func (cc * CollectionCollector ) ClusterBlockProposed (block * cluster.Block ) {
78- collection := block .Payload .Collection .Light ()
79-
80- cc .proposals .
81- With (prometheus.Labels {LabelChain : block .ChainID .String ()}).
82- Observe (float64 (collection .Len ()))
83- }
84-
8584// ClusterBlockFinalized updates the guaranteed collection size gauge and
8685// finishes the tx->collection span for each constituent transaction.
8786func (cc * CollectionCollector ) ClusterBlockFinalized (block * cluster.Block ) {
88- collection := block .Payload .Collection .Light ()
89- chainID := block .ChainID
87+ chainID := block .ChainID .String ()
9088
9189 cc .finalizedHeight .
92- With (prometheus.Labels {LabelChain : chainID . String () }).
90+ With (prometheus.Labels {LabelChain : chainID }).
9391 Set (float64 (block .Height ))
9492 cc .guarantees .
9593 With (prometheus.Labels {
96- LabelChain : chainID . String () ,
94+ LabelChain : chainID ,
9795 }).
98- Observe (float64 (collection .Len ()))
96+ Observe (float64 (block . Payload . Collection .Len ()))
9997}
10098
10199// CollectionMaxSize measures the current maximum size of a collection.
102100func (cc * CollectionCollector ) CollectionMaxSize (size uint ) {
103101 cc .maxCollectionSize .Set (float64 (size ))
104102}
103+
104+ // ClusterBlockCreated informs about cluster block being proposed by this node.
105+ // CAUTION: These metrics will represent a partial picture of cluster block creation across the network,
106+ // as each node will only report on cluster blocks where they are the proposer.
107+ // It reports several metrics, specifically how many transactions have been included and how many of them are priority txns.
108+ func (cc * CollectionCollector ) ClusterBlockCreated (block * cluster.Block , priorityTxnsCount uint ) {
109+ chainID := block .ChainID .String ()
110+
111+ cc .collectionSize .
112+ With (prometheus.Labels {LabelChain : chainID }).
113+ Observe (float64 (block .Payload .Collection .Len ()))
114+
115+ cc .priorityTxns .
116+ With (prometheus.Labels {LabelChain : chainID }).
117+ Observe (float64 (priorityTxnsCount ))
118+ }
0 commit comments