ARO-RP/pkg/database/metrics.go

27 строки
535 B
Go
Исходник Обычный вид История

2020-01-09 23:34:15 +03:00
package database
// Copyright (c) Microsoft Corporation.
// Licensed under the Apache License 2.0.
import (
"context"
"time"
"github.com/Azure/ARO-RP/pkg/util/recover"
)
2020-04-08 02:55:53 +03:00
func (db *Database) EmitMetrics(ctx context.Context) {
2020-01-09 23:34:15 +03:00
defer recover.Panic(db.log)
t := time.NewTicker(time.Minute)
defer t.Stop()
for range t.C {
i, err := db.OpenShiftClusters.QueueLength(ctx, "OpenShiftClusters")
if err != nil {
db.log.Error(err)
} else {
db.m.EmitGauge("database.openshiftclusters.queue.length", int64(i), nil)
}
}
}