Export a counter of firehose connection errors

main
Max Ignatenko 2024-04-06 21:55:36 +01:00
parent ff0ea08296
commit 1358bc3f08
2 changed files with 6 additions and 0 deletions

View File

@ -97,6 +97,7 @@ func (c *Consumer) run(ctx context.Context) {
default: default:
if err := c.runOnce(ctx); err != nil { if err := c.runOnce(ctx); err != nil {
log.Error().Err(err).Msgf("Consumer of %q failed (will be restarted): %s", c.remote.Host, err) log.Error().Err(err).Msgf("Consumer of %q failed (will be restarted): %s", c.remote.Host, err)
connectionFailures.WithLabelValues(c.remote.Host).Inc()
} }
time.Sleep(time.Second) time.Sleep(time.Second)
} }

View File

@ -24,3 +24,8 @@ var postsByLanguageIndexed = promauto.NewCounterVec(prometheus.CounterOpts{
Name: "indexer_posts_by_language_count", Name: "indexer_posts_by_language_count",
Help: "Number of posts by language", Help: "Number of posts by language",
}, []string{"remote", "lang"}) }, []string{"remote", "lang"})
var connectionFailures = promauto.NewCounterVec(prometheus.CounterOpts{
Name: "consumer_connection_failures",
Help: "Counter of firehose connection failures",
}, []string{"remote"})