fix: handle 0 step interval (#7307)

This commit is contained in:
Nityananda Gohain 2025-03-13 22:20:54 +05:30 committed by GitHub
parent 7f71c0ed2d
commit e614d6b0e9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -2,6 +2,7 @@ package inframetrics
import (
"context"
"errors"
"fmt"
"math"
"sort"
@ -15,6 +16,7 @@ import (
"go.signoz.io/signoz/pkg/query-service/model"
v3 "go.signoz.io/signoz/pkg/query-service/model/v3"
"go.signoz.io/signoz/pkg/query-service/postprocess"
"go.uber.org/zap"
"golang.org/x/exp/maps"
"golang.org/x/exp/slices"
)
@ -413,6 +415,10 @@ func (h *HostsRepo) GetHostList(ctx context.Context, req model.HostListRequest)
}
step := int64(math.Max(float64(common.MinAllowedStepInterval(req.Start, req.End)), 60))
if step <= 0 {
zap.L().Error("step is less than or equal to 0", zap.Int64("step", step))
return resp, errors.New("step is less than or equal to 0")
}
query := HostsTableListQuery.Clone()