From e614d6b0e9bc359e90b1e3e39d82fe80a998b6e1 Mon Sep 17 00:00:00 2001 From: Nityananda Gohain Date: Thu, 13 Mar 2025 22:20:54 +0530 Subject: [PATCH] fix: handle 0 step interval (#7307) --- pkg/query-service/app/inframetrics/hosts.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pkg/query-service/app/inframetrics/hosts.go b/pkg/query-service/app/inframetrics/hosts.go index 5372831d58..39a5ea2830 100644 --- a/pkg/query-service/app/inframetrics/hosts.go +++ b/pkg/query-service/app/inframetrics/hosts.go @@ -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()