Advertisement
Guest User

Untitled

a guest
Jan 10th, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Go 1.14 KB | None | 0 0
  1. // Check if any pending alerts should be removed or fire now. Write out alert timeseries.
  2.     for fp, a := range r.active {
  3.         fmt.Println("S")
  4.         if _, ok := resultFPs[fp]; !ok {
  5.             fmt.Println("HERE1")
  6.             // If the alert was previously firing, keep it around for a given
  7.             // retention time so it is reported as resolved to the AlertManager.
  8.             if a.State == StatePending || (!a.ResolvedAt.IsZero() && ts.Sub(a.ResolvedAt) > resolvedRetention) {
  9.                 fmt.Println("HERE2")
  10.                 delete(r.active, fp)
  11.             }
  12.             if a.State != StateInactive {
  13.                 fmt.Println("HERE3")
  14.                 a.State = StateInactive
  15.                 a.ResolvedAt = ts
  16.                 a.FiredAt = time.Time{}
  17.                 fmt.Printf("timeStamp: %v, firedAt %v", a.ResolvedAt, a.FiredAt)
  18.             }
  19.             continue
  20.         }
  21.  
  22.         if a.State == StatePending && ts.Sub(a.ActiveAt) >= r.holdDuration {
  23.             fmt.Println("HERE4")
  24.             a.State = StateFiring
  25.             a.FiredAt = ts
  26.         }
  27.  
  28.         // if a.State == StateFiring && ts.Sub(a.ActiveAt) < r.holdDuration {
  29.         //  fmt.Println("HERE7")
  30.         //  a.State = StateInactive
  31.         //  a.FiredAt = ts
  32.         // }
  33.  
  34.         fmt.Println("HERE5")
  35.         vec = append(vec, r.sample(a, ts))
  36.     }
  37.     fmt.Println("HERE6")
  38.     return vec, nil
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement