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/services/ngalert/state/historian/backend.go

37 lines
858 B

package historian
import (
"fmt"
"strings"
)
// BackendType identifies different kinds of state history backends.
type BackendType string
// String implements Stringer for BackendType.
func (bt BackendType) String() string {
return string(bt)
}
const (
BackendTypeAnnotations BackendType = "annotations"
BackendTypeLoki BackendType = "loki"
BackendTypeMultiple BackendType = "multiple"
BackendTypeNoop BackendType = "noop"
)
func ParseBackendType(s string) (BackendType, error) {
norm := strings.ToLower(strings.TrimSpace(s))
types := map[BackendType]struct{}{
BackendTypeAnnotations: {},
BackendTypeLoki: {},
BackendTypeMultiple: {},
BackendTypeNoop: {},
}
p := BackendType(norm)
if _, ok := types[p]; !ok {
return "", fmt.Errorf("unrecognized state history backend: %s", p)
}
return p, nil
}