Add few more metrics
This commit is contained in:
parent
334af033b8
commit
1d25842b78
5 changed files with 77 additions and 13 deletions
|
@ -91,10 +91,13 @@ func (l *Lister) run(ctx context.Context) {
|
|||
break
|
||||
}
|
||||
log.Info().Msgf("Received %d DIDs from %q", len(dids), remote.Host)
|
||||
reposListed.WithLabelValues(remote.Host).Add(float64(len(dids)))
|
||||
|
||||
for _, did := range dids {
|
||||
if _, err := repo.EnsureExists(ctx, l.db, did); err != nil {
|
||||
if _, created, err := repo.EnsureExists(ctx, l.db, did); err != nil {
|
||||
log.Error().Err(err).Msgf("Failed to ensure that we have a record for the repo %q: %s", did, err)
|
||||
} else if created {
|
||||
reposDiscovered.WithLabelValues(remote.Host).Inc()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
16
cmd/lister/metrics.go
Normal file
16
cmd/lister/metrics.go
Normal file
|
@ -0,0 +1,16 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
"github.com/prometheus/client_golang/prometheus/promauto"
|
||||
)
|
||||
|
||||
var reposDiscovered = promauto.NewCounterVec(prometheus.CounterOpts{
|
||||
Name: "repo_discovered_counter",
|
||||
Help: "Counter of newly discovered repos",
|
||||
}, []string{"remote"})
|
||||
|
||||
var reposListed = promauto.NewCounterVec(prometheus.CounterOpts{
|
||||
Name: "repo_listed_counter",
|
||||
Help: "Counter of repos received by listing PDSs.",
|
||||
}, []string{"remote"})
|
Loading…
Add table
Add a link
Reference in a new issue