mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
42 lines
859 B
Go
42 lines
859 B
Go
package resource
|
|
|
|
import (
|
|
"sync"
|
|
|
|
"github.com/prometheus/client_golang/prometheus"
|
|
)
|
|
|
|
var (
|
|
once sync.Once
|
|
StorageServerMetrics *StorageApiMetrics
|
|
)
|
|
|
|
type StorageApiMetrics struct {
|
|
OptimisticLockFailed *prometheus.CounterVec
|
|
}
|
|
|
|
func NewStorageMetrics() *StorageApiMetrics {
|
|
once.Do(func() {
|
|
StorageServerMetrics = &StorageApiMetrics{
|
|
OptimisticLockFailed: prometheus.NewCounterVec(
|
|
prometheus.CounterOpts{
|
|
Namespace: "resource_storage",
|
|
Name: "optimistic_lock_failed",
|
|
Help: "count of optimistic locks failed",
|
|
},
|
|
[]string{"action"},
|
|
),
|
|
}
|
|
})
|
|
|
|
return StorageServerMetrics
|
|
}
|
|
|
|
func (s *StorageApiMetrics) Collect(ch chan<- prometheus.Metric) {
|
|
s.OptimisticLockFailed.Collect(ch)
|
|
}
|
|
|
|
func (s *StorageApiMetrics) Describe(ch chan<- *prometheus.Desc) {
|
|
s.OptimisticLockFailed.Describe(ch)
|
|
}
|