The open and composable observability and data visualization platform. Visualize metrics, logs, and traces from multiple sources like Prometheus, Loki, Elasticsearch, InfluxDB, Postgres and many more.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
grafana/pkg/metrics/metric_ref.go

39 lines
845 B

package metrics
type comboCounterRef struct {
usageCounter Counter
metricCounter Counter
}
func NewComboCounterRef(name string) Counter {
cr := &comboCounterRef{}
cr.usageCounter = UsageStats.GetOrRegister(name, NewCounter).(Counter)
cr.metricCounter = MetricStats.GetOrRegister(name, NewCounter).(Counter)
return cr
}
func (c comboCounterRef) Clear() {
c.usageCounter.Clear()
c.metricCounter.Clear()
}
func (c comboCounterRef) Count() int64 {
panic("Count called on a combocounter ref")
}
// Dec panics.
func (c comboCounterRef) Dec(i int64) {
c.usageCounter.Dec(i)
c.metricCounter.Dec(i)
}
// Inc panics.
func (c comboCounterRef) Inc(i int64) {
c.usageCounter.Inc(i)
c.metricCounter.Inc(i)
}
// Snapshot returns the snapshot.
func (c comboCounterRef) Snapshot() Counter {
panic("snapshot called on a combocounter ref")
}