models.go 851 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. package alerting
  2. import "time"
  3. type AlertJob struct {
  4. Offset int64
  5. Delay bool
  6. Running bool
  7. RetryCount int
  8. Rule *AlertRule
  9. }
  10. func (aj *AlertJob) Retryable() bool {
  11. return aj.RetryCount < maxAlertExecutionRetries
  12. }
  13. func (aj *AlertJob) ResetRetry() {
  14. aj.RetryCount = 0
  15. }
  16. func (aj *AlertJob) IncRetry() {
  17. aj.RetryCount++
  18. }
  19. type AlertResult struct {
  20. State string
  21. ActualValue float64
  22. Duration float64
  23. TriggeredAlerts []*TriggeredAlert
  24. Description string
  25. Error error
  26. AlertJob *AlertJob
  27. ExeuctionTime time.Time
  28. }
  29. type TriggeredAlert struct {
  30. ActualValue float64
  31. Name string
  32. State string
  33. }
  34. type Level struct {
  35. Operator string
  36. Value float64
  37. }
  38. type AlertQuery struct {
  39. Query string
  40. DatasourceId int64
  41. From string
  42. To string
  43. }