|
|
@@ -182,17 +182,32 @@ func (c *collector) GatherStorageMetrics(ctx context.Context) {
|
|
|
}
|
|
|
slog.Debug("Collecting metrics from the database")
|
|
|
|
|
|
- usersGauge.Set(float64(c.store.CountUsers()))
|
|
|
- brokenFeedsGauge.Set(float64(c.store.CountAllFeedsWithErrors()))
|
|
|
+ if usersCount, err := c.store.CountUsers(); err != nil {
|
|
|
+ slog.Warn("Unable to collect users metric", slog.Any("error", err))
|
|
|
+ } else {
|
|
|
+ usersGauge.Set(float64(usersCount))
|
|
|
+ }
|
|
|
+
|
|
|
+ if brokenFeedsCount, err := c.store.CountAllFeedsWithErrors(); err != nil {
|
|
|
+ slog.Warn("Unable to collect broken feeds metric", slog.Any("error", err))
|
|
|
+ } else {
|
|
|
+ brokenFeedsGauge.Set(float64(brokenFeedsCount))
|
|
|
+ }
|
|
|
|
|
|
- feedsCount := c.store.CountAllFeeds()
|
|
|
- for status, count := range feedsCount {
|
|
|
- feedsGauge.WithLabelValues(status).Set(float64(count))
|
|
|
+ if feedsCount, err := c.store.CountAllFeeds(); err != nil {
|
|
|
+ slog.Warn("Unable to collect feeds metric", slog.Any("error", err))
|
|
|
+ } else {
|
|
|
+ for status, count := range feedsCount {
|
|
|
+ feedsGauge.WithLabelValues(status).Set(float64(count))
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
- entriesCount := c.store.CountAllEntries()
|
|
|
- for status, count := range entriesCount {
|
|
|
- entriesGauge.WithLabelValues(status).Set(float64(count))
|
|
|
+ if entriesCount, err := c.store.CountAllEntries(); err != nil {
|
|
|
+ slog.Warn("Unable to collect entries metric", slog.Any("error", err))
|
|
|
+ } else {
|
|
|
+ for status, count := range entriesCount {
|
|
|
+ entriesGauge.WithLabelValues(status).Set(float64(count))
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
dbStats := c.store.DBStats()
|