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.
TypeScript apmapplication-monitoringdistributed-tracinggogood-first-issuejaegerloglogsmetricsmonitoringnextjsobservabilityopen-sourceopentelemetryprometheusreactreactjsself-hostedtracingtypescript
fix: metrics order by avg (#5029)
Srikanth Chekuricf64da2631f9
diff --git a/pkg/query-service/app/limit.go b/pkg/query-service/app/limit.goindex 55dd56a31c..3ace3c687c 100644--- a/pkg/query-service/app/limit.go+++ b/pkg/query-service/app/limit.go@@ -40,7 +40,7 @@ func applyMetricLimit(results []*v3.Result, queryRangeParams *v3.QueryRangeParam}}- ithSum, jthSum, ithCount, jthCount := 0.0, 0.0, 1.0, 1.0+ ithSum, jthSum, ithCount, jthCount := 0.0, 0.0, 0.0, 0.0for _, point := range result.Series[i].Points {if math.IsNaN(point.Value) || math.IsInf(point.Value, 0) {continue@@ -57,6 +57,10 @@ func applyMetricLimit(results []*v3.Result, queryRangeParams *v3.QueryRangeParamjthCount++}+ // avoid division by zero+ ithCount = math.Max(ithCount, 1)+ jthCount = math.Max(jthCount, 1)+if orderBy.Order == "asc" {return ithSum/ithCount < jthSum/jthCount} else if orderBy.Order == "desc" {