@@ -26,6 +26,7 @@ import (
2626 "github.com/aldor007/mort/pkg/object"
2727 "github.com/aldor007/mort/pkg/processor"
2828 "github.com/aldor007/mort/pkg/response"
29+ "github.com/aldor007/mort/pkg/storage"
2930 "github.com/aldor007/mort/pkg/throttler"
3031 "github.com/prometheus/client_golang/prometheus"
3132 "github.com/prometheus/client_golang/prometheus/promhttp"
@@ -171,6 +172,16 @@ func configureMonitoring(mortConfig *config.Config) {
171172 Help : "mort count of vips cache cleanups" ,
172173 }))
173174
175+ p .RegisterCounter ("glacier_error_detected" , prometheus .NewCounter (prometheus.CounterOpts {
176+ Name : "mort_glacier_error_detected" ,
177+ Help : "mort count of GLACIER/DEEP_ARCHIVE errors detected" ,
178+ }))
179+
180+ p .RegisterCounter ("glacier_restore_initiated" , prometheus .NewCounter (prometheus.CounterOpts {
181+ Name : "mort_glacier_restore_initiated" ,
182+ Help : "mort count of GLACIER restore requests initiated" ,
183+ }))
184+
174185 p .RegisterHistogramVec ("storage_time" , prometheus .NewHistogramVec (prometheus.HistogramOpts {
175186 Name : "mort_storage_time" ,
176187 Help : "mort storage times" ,
@@ -243,6 +254,11 @@ func main() {
243254
244255 rp := processor .NewRequestProcessor (imgConfig .Server , lock .Create (imgConfig .Server .Lock , imgConfig .Server .LockTimeout ), throttler .NewBucketThrottler (concurrentLimit ))
245256
257+ // Initialize archive restore cache at startup to prevent lazy initialization panics
258+ // This ensures the cache is ready before any requests arrive
259+ _ = storage .GetRestoreCache (imgConfig .Server .Cache )
260+ monitoring .Log ().Info ("Archive restore cache initialized" )
261+
246262 if imgConfig .Server .AccessLog {
247263 logger := httplog .NewLogger ("mort" , httplog.Options {
248264 JSON : true ,
0 commit comments