models.go 1007 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. package alerting
  2. import (
  3. "github.com/grafana/grafana/pkg/components/simplejson"
  4. "github.com/grafana/grafana/pkg/tsdb"
  5. )
  6. type AlertJob struct {
  7. Offset int64
  8. Delay bool
  9. Running bool
  10. RetryCount int
  11. Rule *AlertRule
  12. }
  13. type AlertResult struct {
  14. State string
  15. ActualValue float64
  16. Duration float64
  17. Description string
  18. Error error
  19. AlertJob *AlertJob
  20. }
  21. type AlertRule struct {
  22. Id int64
  23. OrgId int64
  24. DashboardId int64
  25. PanelId int64
  26. Frequency int64
  27. Name string
  28. Description string
  29. State string
  30. Warning Level
  31. Critical Level
  32. Query AlertQuery
  33. Transform string
  34. TransformParams simplejson.Json
  35. }
  36. type Transformer interface {
  37. Transform(tsdb tsdb.TimeSeriesSlice) float64
  38. }
  39. type Level struct {
  40. Operator string
  41. Level float64
  42. }
  43. type AlertQuery struct {
  44. Query string
  45. DatasourceId int64
  46. Aggregator string
  47. From string
  48. To string
  49. }