@@ -75,6 +75,7 @@ type TSDBState struct {
75
75
// Head compactions metrics.
76
76
compactionsTriggered prometheus.Counter
77
77
compactionsFailed prometheus.Counter
78
+ walReplayTime prometheus.Histogram
78
79
}
79
80
80
81
// NewV2 returns a new Ingester that uses prometheus block storage instead of chunk storage
@@ -110,6 +111,11 @@ func NewV2(cfg Config, clientConfig client.Config, limits *validation.Overrides,
110
111
Name : "cortex_ingester_tsdb_compactions_failed_total" ,
111
112
Help : "Total number of compactions that failed." ,
112
113
}),
114
+ walReplayTime : promauto .With (registerer ).NewHistogram (prometheus.HistogramOpts {
115
+ Name : "cortex_ingester_tsdb_wal_replay_duration_seconds" ,
116
+ Help : "The total time it takes to open and replay a TSDB WAL." ,
117
+ Buckets : prometheus .DefBuckets ,
118
+ }),
113
119
},
114
120
}
115
121
@@ -857,6 +863,10 @@ func (i *Ingester) openExistingTSDB(ctx context.Context) error {
857
863
go func (userID string ) {
858
864
defer wg .Done ()
859
865
defer openGate .Done ()
866
+ defer func (ts time.Time ) {
867
+ i .TSDBState .walReplayTime .Observe (time .Since (ts ).Seconds ())
868
+ }(time .Now ())
869
+
860
870
db , err := i .createTSDB (userID )
861
871
if err != nil {
862
872
level .Error (util .Logger ).Log ("msg" , "unable to open user TSDB" , "err" , err , "user" , userID )
0 commit comments