Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: MetroclusterCheck collector should report "no instances" #3314

Merged
merged 2 commits into from
Nov 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion cmd/collectors/rest/rest.go
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,8 @@ func (r *Rest) PollData() (map[string]*matrix.Matrix, error) {

startTime := time.Now()
if err := rest.FetchAllStream(r.Client, r.Prop.Href, processBatch); err != nil {
return nil, err
_, err2 := r.handleError(err)
return nil, err2
}
apiD += time.Since(startTime)

Expand Down
15 changes: 3 additions & 12 deletions cmd/poller/collector/collector.go
Original file line number Diff line number Diff line change
Expand Up @@ -399,10 +399,7 @@ func (c *AbstractCollector) Start(wg *sync.WaitGroup) {
case errors.Is(err, errs.ErrNoInstance):
c.Schedule.SetStandByModeMax(task, 5*time.Minute)
c.SetStatus(1, errs.ErrNoInstance.Error())
c.Logger.Info(
"no instances, entering standby",
slog.String("task", task.Name),
)
c.Logger.Info("no instances, entering standby", slog.String("task", task.Name))
// no metrics available
case errors.Is(err, errs.ErrNoMetric):
c.SetStatus(1, errs.ErrNoMetric.Error())
Expand All @@ -412,16 +409,10 @@ func (c *AbstractCollector) Start(wg *sync.WaitGroup) {
slog.String("task", task.Name),
slog.String("object", c.Object),
)
// Metro cluster is not configured
// Metro cluster is not configured, this is similar to no instance except with a larger delay and no logging
case errors.Is(err, errs.ErrMetroClusterNotConfigured):
var herr errs.HarvestError
errMsg := err.Error()
if ok := errors.As(err, &herr); ok {
errMsg = herr.Inner.Error()
}
c.SetStatus(1, errMsg)
c.Schedule.SetStandByModeMax(task, 1*time.Hour)
// no need to log this
c.SetStatus(1, errs.ErrNoInstance.Error())

// not an error we are expecting, so enter failed or standby state
default:
Expand Down