Skip to content

Commit

Permalink
chore(monitors): remove second delay field
Browse files Browse the repository at this point in the history
  • Loading branch information
Rambatino committed Jul 30, 2024
1 parent 18633d5 commit 42692a4
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 32 deletions.
9 changes: 0 additions & 9 deletions axiom/monitors.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,6 @@ type Monitor struct {
Interval time.Duration `json:"IntervalMinutes"`
// Range the monitor goes back in time and looks at the data it acts on.
Range time.Duration `json:"RangeMinutes"`
// SecondDelay sets how long in seconds after the end time of the query range that the monitor should run.
SecondDelay time.Duration `json:"secondDelay"`
// Disabled sets whether the monitor is disabled or not.
Disabled bool `json:"disabled"`
// DisabledUntil is the time that the monitor will be disabled until.
Expand All @@ -156,9 +154,6 @@ func (m Monitor) MarshalJSON() ([]byte, error) {
m.Range = time.Duration(m.Range.Minutes())
m.Interval = time.Duration(m.Interval.Minutes())

// Set to the value in seconds.
m.SecondDelay = time.Duration(m.SecondDelay.Seconds())

return json.Marshal(localMonitor(m))
}

Expand All @@ -182,10 +177,6 @@ func (m *Monitor) UnmarshalJSON(b []byte) error {
m.Range *= time.Minute
m.Interval *= time.Minute

// Set to a proper time.Duration value by interpreting the server response
// value in seconds.
m.SecondDelay *= time.Second

return nil
}

Expand Down
23 changes: 0 additions & 23 deletions axiom/monitors_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,26 +170,3 @@ func (s *MonitorsTestSuite) TestCreateMatchMonitor() {
s.Require().NotNil(monitor)
s.False(monitor.Disabled, "monitor should be enabled")
}

func (s *MonitorsTestSuite) TestMonitorTimeDurationBehaviour() {
// Create the monitor
monitor, err := s.client.Monitors.Create(s.ctx, axiom.MonitorCreateRequest{
Monitor: axiom.Monitor{
AlertOnNoData: false,
APLQuery: fmt.Sprintf("['%s'] | summarize count() by bin_auto(_time)", s.datasetID),
Description: "A test monitor",
Interval: time.Minute,
Name: "Test Monitor",
Operator: axiom.BelowOrEqual,
Range: time.Minute * 5,
Threshold: 1,
SecondDelay: time.Second * 100,
},
})
s.Require().NoError(err)
s.Require().NotNil(monitor)

s.Equal(100., monitor.SecondDelay.Seconds())
s.Equal(5., monitor.Range.Minutes())
s.Equal(1., monitor.Interval.Minutes())
}

0 comments on commit 42692a4

Please sign in to comment.