Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit abbd522

Browse files
chore: appease linter
1 parent fe1e805 commit abbd522

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

coderd/agentapi/resources_monitoring.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,10 @@ import (
88
"slices"
99
"time"
1010

11-
"cdr.dev/slog"
1211
"golang.org/x/xerrors"
1312

13+
"cdr.dev/slog"
14+
1415
"github.com/google/uuid"
1516

1617
agentproto "github.com/coder/coder/v2/agent/proto"
@@ -214,13 +215,13 @@ func (a *ResourcesMonitoringAPI) monitorVolumes(ctx context.Context, datapoints
214215
return nil
215216
}
216217

217-
func (m *ResourcesMonitoringAPI) calculateNextState(
218+
func (a *ResourcesMonitoringAPI) calculateNextState(
218219
oldState database.WorkspaceAgentMonitorState,
219220
states []database.WorkspaceAgentMonitorState,
220221
) database.WorkspaceAgentMonitorState {
221222
// If we do not have an OK in the last `X` datapoints, then we are
222223
// in an alert state.
223-
lastXStates := states[max(len(states)-m.ConsecutiveNOKsToAlert, 0):]
224+
lastXStates := states[max(len(states)-a.ConsecutiveNOKsToAlert, 0):]
224225
if !slices.Contains(lastXStates, database.WorkspaceAgentMonitorStateOK) {
225226
return database.WorkspaceAgentMonitorStateNOK
226227
}
@@ -233,7 +234,7 @@ func (m *ResourcesMonitoringAPI) calculateNextState(
233234
}
234235

235236
// If there are enough NOK datapoints, we should be in an alert state.
236-
if nokCount >= m.MinimumNOKsToAlert {
237+
if nokCount >= a.MinimumNOKsToAlert {
237238
return database.WorkspaceAgentMonitorStateNOK
238239
}
239240

0 commit comments

Comments
 (0)