[#373] blobovnicza: Add metrics

Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
Dmitrii Stepanov 2023-06-20 11:23:17 +03:00
parent 01a0c97760
commit 028d4a8058
5 changed files with 67 additions and 23 deletions

View file

@ -31,6 +31,8 @@ type cfg struct {
objSizeLimit uint64
log *logger.Logger
metrics Metrics
}
type boltDBCfg struct {
@ -52,6 +54,7 @@ func defaultCfg(c *cfg) {
fullSizeLimit: 1 << 30, // 1GB
objSizeLimit: 1 << 20, // 1MB
log: &logger.Logger{Logger: zap.L()},
metrics: &noopMetrics{},
}
}
@ -112,3 +115,10 @@ func WithReadOnly(ro bool) Option {
c.boltOptions.ReadOnly = ro
}
}
// WithMetrics returns an option to set metrics storage.
func WithMetrics(m Metrics) Option {
return func(c *cfg) {
c.metrics = m
}
}