Documentation
¶
Index ¶
- Constants
- func OffsetClock(d time.Duration) offsetClock
- type AlertOption
- type Alerter
- type Simulation
- func (as Simulation) Call(ctx context.Context, call *calls.Call) error
- func (Simulation) Enabled() bool
- func (as Simulation) Go(ctx context.Context)
- func (as Simulation) HUP(cfg *config.Config)
- func (a Simulation) Name() string
- func (as Simulation) PrivateRoutes(r chi.Router)
- func (s *Simulation) Simulate(ctx context.Context) (trending.Scores[talkgroups.ID], error)
- func (as Simulation) SinkType() string
Constants ¶
View Source
const ( ScoreThreshold = -1 CountThreshold = 1.0 IgnoreFailureCountThreshold = 3 NotificationSubject = "Stillbox Alert" DefaultRenotify = 30 * time.Minute )
Variables ¶
This section is empty.
Functions ¶
func OffsetClock ¶
OffsetClock returns a clock whose Now() method returns the specified offset from the current time.
Types ¶
type AlertOption ¶
type AlertOption func(*alerter)
func WithAlertStore ¶
func WithAlertStore(st alertstore.Store) AlertOption
func WithClock ¶
func WithClock(clock timeseries.Clock) AlertOption
WithClock makes the alerter use a simulated clock.
func WithMetrics ¶
func WithMetrics(met metrics.Metrics) AlertOption
type Alerter ¶
type Simulation ¶
type Simulation struct {
// normal Alerting config
config.Alerting
// ScoreStart is the time when scoring begins
ScoreStart jsontypes.Time `json:"scoreStart" yaml:"scoreStart" form:"scoreStart"`
// ScoreEnd is the time when the score simulator ends. Left blank, it defaults to time.Now()
ScoreEnd jsontypes.Time `json:"scoreEnd" yaml:"scoreEnd" form:"scoreEnd"`
// SimInterval is the interval at which the scorer will be called
SimInterval jsontypes.Duration `json:"simInterval" yaml:"simInterval" form:"simInterval"`
// contains filtered or unexported fields
}
A Simulation simulates what happens to the alerter during a specified time period using past data from the database.
func (Simulation) PrivateRoutes ¶
func (*Simulation) Simulate ¶
func (s *Simulation) Simulate(ctx context.Context) (trending.Scores[talkgroups.ID], error)
Simulate begins the simulation using the DB handle from ctx. It returns final scores.
Click to show internal directories.
Click to hide internal directories.