Open hifi opened 1 year ago
I haven't really figured out any neat way. The per-database metrics are what I'd want to disable but keep the replica ones as they are aggregates. Promauto is very handy but it's also an anti-pattern for libraries when you want to control what metrics are being exported.
When using Litestream as a library we found out that since
litestream.NewDB
exposes new promauto metrics there are a couple of issues. For one we can't disable metrics collection while we use Prometheus metrics within the main program so we're currently forced to expose per-database metrics.Other is that we hit an unexpected deadlock as it seems the go Prometheus module holds a global lock while scraping and if the scraper is locked out and new metrics are being added it will deadlock as it will access the same lock. Making it easier to configure metrics collection and not explicitly adding them in NewDB would be a good start.