mirror of
https://hubproxy.babadafafafafa.cn/https://github.com/yunionio/cloudpods.git
synced 2026-09-21 00:24:07 +08:00
28 lines
577 B
Go
28 lines
577 B
Go
package metricquery
|
|
|
|
import (
|
|
"yunion.io/x/onecloud/pkg/apis/monitor"
|
|
"yunion.io/x/onecloud/pkg/monitor/tsdb"
|
|
)
|
|
|
|
type Metrics struct {
|
|
Series tsdb.TimeSeriesSlice
|
|
Metas []tsdb.QueryResultMeta
|
|
}
|
|
|
|
type MetricQuery interface {
|
|
ExecuteQuery() (*Metrics, error)
|
|
}
|
|
|
|
type QueryFactory func(model []*monitor.AlertCondition) (MetricQuery, error)
|
|
|
|
var queryFactories = make(map[string]QueryFactory)
|
|
|
|
func RegisterMetricQuery(typeName string, factory QueryFactory) {
|
|
queryFactories[typeName] = factory
|
|
}
|
|
|
|
func GetQueryFactories() map[string]QueryFactory {
|
|
return queryFactories
|
|
}
|