[#373] blobovniczatree: Add metrics

Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
Dmitrii Stepanov 2023-06-05 10:25:25 +03:00
parent 3ae3c8dfdb
commit 8318d90ad0
11 changed files with 157 additions and 15 deletions

View file

@ -21,6 +21,7 @@ type cfg struct {
blzOpts []blobovnicza.Option
// reportError is the function called when encountering disk errors.
reportError func(string, error)
metrics Metrics
}
type Option func(*cfg)
@ -40,6 +41,7 @@ func initConfig(c *cfg) {
blzShallowDepth: defaultBlzShallowDepth,
blzShallowWidth: defaultBlzShallowWidth,
reportError: func(string, error) {},
metrics: &noopMetrics{},
}
}
@ -91,3 +93,9 @@ func WithObjectSizeLimit(sz uint64) Option {
c.blzOpts = append(c.blzOpts, blobovnicza.WithObjectSizeLimit(sz))
}
}
func WithMetrics(m Metrics) Option {
return func(c *cfg) {
c.metrics = m
}
}