models.go 830 B

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