mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-09 21:38:05 -05:00
* Rename existing AttestationCache * Cache with simple Add * fix import cycle * logic for unaggregated, aggregated and block attestations * some small fixes * remove Seen * finishing touches * feature flag * extract forkchoice atts to separate type * gate new functionality behind feature flag * revert test files * preparing for review * change Id to [32]byte * Potuz's review * Potuz's review pt 2 * Nishant's review * keep flat list of atts * fix ForkchoiceAttestations() function * Tests for Add, GetAll, Count * Tests for remaining functions * use DeepEqual * fix tests * documentation * changelog <3 * v2 handlers * nil check for forkchoice atts * guard against 0 bits set * fix failing test * Preston's review * better godocs
68 lines
2.3 KiB
Go
68 lines
2.3 KiB
Go
package attestations
|
|
|
|
import (
|
|
"github.com/prometheus/client_golang/prometheus"
|
|
"github.com/prometheus/client_golang/prometheus/promauto"
|
|
)
|
|
|
|
var (
|
|
aggregatedAttsCount = promauto.NewGauge(
|
|
prometheus.GaugeOpts{
|
|
Name: "aggregated_attestations_in_pool_total",
|
|
Help: "The number of aggregated attestations in the pool.",
|
|
},
|
|
)
|
|
unaggregatedAttsCount = promauto.NewGauge(
|
|
prometheus.GaugeOpts{
|
|
Name: "unaggregated_attestations_in_pool_total",
|
|
Help: "The number of unaggregated attestations in the pool.",
|
|
},
|
|
)
|
|
expiredAggregatedAtts = promauto.NewCounter(prometheus.CounterOpts{
|
|
Name: "expired_aggregated_atts_total",
|
|
Help: "The number of expired and deleted aggregated attestations in the pool.",
|
|
})
|
|
expiredUnaggregatedAtts = promauto.NewCounter(prometheus.CounterOpts{
|
|
Name: "expired_unaggregated_atts_total",
|
|
Help: "The number of expired and deleted unaggregated attestations in the pool.",
|
|
})
|
|
expiredBlockAtts = promauto.NewCounter(prometheus.CounterOpts{
|
|
Name: "expired_block_atts_total",
|
|
Help: "The number of expired and deleted block attestations in the pool.",
|
|
})
|
|
attCount = promauto.NewGauge(
|
|
prometheus.GaugeOpts{
|
|
Name: "attestations_in_pool_total",
|
|
Help: "The number of attestations in the pool.",
|
|
},
|
|
)
|
|
expiredAtts = promauto.NewCounter(prometheus.CounterOpts{
|
|
Name: "expired_atts_total",
|
|
Help: "The number of expired and deleted attestations in the pool.",
|
|
})
|
|
batchForkChoiceAttsT1 = promauto.NewHistogram(
|
|
prometheus.HistogramOpts{
|
|
Name: "aggregate_attestations_t1",
|
|
Help: "Captures times of attestation aggregation in milliseconds during the first interval per slot",
|
|
Buckets: []float64{10, 20, 50, 100, 200, 300, 500, 1000},
|
|
},
|
|
)
|
|
batchForkChoiceAttsT2 = promauto.NewHistogram(
|
|
prometheus.HistogramOpts{
|
|
Name: "aggregate_attestations_t2",
|
|
Help: "Captures times of attestation aggregation in milliseconds during the second interval per slot",
|
|
Buckets: []float64{10, 40, 100, 200, 600},
|
|
},
|
|
)
|
|
)
|
|
|
|
func (s *Service) updateMetrics() {
|
|
aggregatedAttsCount.Set(float64(s.cfg.Pool.AggregatedAttestationCount()))
|
|
unaggregatedAttsCount.Set(float64(s.cfg.Pool.UnaggregatedAttestationCount()))
|
|
}
|
|
|
|
func (s *Service) updateMetricsExperimental(numExpired uint64) {
|
|
attCount.Set(float64(s.cfg.Cache.Count()))
|
|
expiredAtts.Add(float64(numExpired))
|
|
}
|