Skip to content

SigNoz is an open-source, OpenTelemetry-native observability platform for your team and their AI agents. Get logs, metrics, and traces in one tool with features like APM, distributed tracing, log management, infra monitoring, etc. Combined with SigNoz MCP and a native AI teammate (in SigNoz Cloud) it helps you build more resilient apps.

fix: handle 0 step interval (#7307)

Nityananda Gohaine614d6b0e9bc
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()