@@ -603,9 +603,6 @@ type DBGauges struct { // these gauges are shared by all MDBX instances, but nee
603603 GcLeafMetric * metrics.GaugeVec
604604 GcOverflowMetric * metrics.GaugeVec
605605 GcPagesMetric * metrics.GaugeVec
606-
607- GCMaxRetainedPages * metrics.GaugeVec
608- GCMaxReaderLag * metrics.GaugeVec
609606}
610607
611608type DBSummaries struct { // the summaries are particular to a DB instance
@@ -616,6 +613,11 @@ type DBSummaries struct { // the summaries are particular to a DB instance
616613 DbCommitTotal metrics.Summary
617614}
618615
616+ type GCSummaries struct { // GC metric summaries for each DB instance
617+ GCMaxRetainedPages metrics.Summary
618+ GCMaxReaderLag metrics.Summary
619+ }
620+
619621// InitMDBXMGauges this only needs to be called once during startup
620622func InitMDBXMGauges () * DBGauges {
621623 return & DBGauges {
@@ -638,9 +640,6 @@ func InitMDBXMGauges() *DBGauges {
638640 GcLeafMetric : metrics .GetOrCreateGaugeVec (`db_gc_leaf` , []string {dbLabelName }),
639641 GcOverflowMetric : metrics .GetOrCreateGaugeVec (`db_gc_overflow` , []string {dbLabelName }),
640642 GcPagesMetric : metrics .GetOrCreateGaugeVec (`db_gc_pages` , []string {dbLabelName }),
641-
642- GCMaxRetainedPages : metrics .GetOrCreateGaugeVec (`db_gc_max_retained_pages` , []string {dbLabelName }),
643- GCMaxReaderLag : metrics .GetOrCreateGaugeVec (`db_gc_max_reader_lag` , []string {dbLabelName }),
644643 }
645644}
646645
@@ -658,8 +657,20 @@ func InitSummaries(dbLabel Label) {
658657 }
659658}
660659
660+ func InitGCSummaries (dbLabel Label ) {
661+ _ , ok := MDBXGCSummaries .Load (dbLabel )
662+ if ! ok {
663+ dbName := string (dbLabel )
664+ MDBXGCSummaries .Store (dbName , & GCSummaries {
665+ GCMaxRetainedPages : metrics .GetOrCreateSummaryWithLabels (`db_gc_max_retained_pages` , []string {dbLabelName }, []string {dbName }),
666+ GCMaxReaderLag : metrics .GetOrCreateSummaryWithLabels (`db_gc_max_reader_lag` , []string {dbLabelName }, []string {dbName }),
667+ })
668+ }
669+ }
670+
661671var MDBXGauges = InitMDBXMGauges () // global mdbx gauges. each gauge can be filtered by db name
662672var MDBXSummaries sync.Map // dbName => Summaries mapping
673+ var MDBXGCSummaries sync.Map // dbName => GCSummaries mapping
663674
664675var (
665676 ErrAttemptToDeleteNonDeprecatedBucket = errors .New ("only buckets from dbutils.ChaindataDeprecatedTables can be deleted" )
0 commit comments