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: nan aggregation values are ignored (#2664)
Srikanth Chekuric5991b50bc1b
diff --git a/pkg/query-service/app/metrics/query_builder.go b/pkg/query-service/app/metrics/query_builder.goindex c57cdf49ca..16620bf7cc 100644--- a/pkg/query-service/app/metrics/query_builder.go+++ b/pkg/query-service/app/metrics/query_builder.go@@ -203,7 +203,7 @@ func BuildMetricQuery(qp *model.QueryRangeParamsV2, mq *model.MetricQuery, tablesubQuery := fmt.Sprintf(queryTmpl, "any(labels) as labels, "+groupTags, qp.Step, op, filterSubQuery, groupBy, groupTags,) // labels will be same so any should be fine- query := `SELECT %s ts, ` + rateWithoutNegative + ` as value FROM(%s)`+ query := `SELECT %s ts, ` + rateWithoutNegative + ` as value FROM(%s) WHERE isNaN(value) = 0`query = fmt.Sprintf(query, "labels as fullLabels,", subQuery)return query, nil@@ -214,14 +214,14 @@ func BuildMetricQuery(qp *model.QueryRangeParamsV2, mq *model.MetricQuery, tablesubQuery := fmt.Sprintf(queryTmpl, rateGroupTags, qp.Step, op, filterSubQuery, rateGroupBy, rateGroupTags,) // labels will be same so any should be fine- query := `SELECT %s ts, ` + rateWithoutNegative + `as value FROM(%s)`+ query := `SELECT %s ts, ` + rateWithoutNegative + `as value FROM(%s) WHERE isNaN(value) = 0`query = fmt.Sprintf(query, groupTags, subQuery)query = fmt.Sprintf(`SELECT %s ts, sum(value) as value FROM (%s) GROUP BY %s ORDER BY %s ts`, groupTags, query, groupBy, groupTags)return query, nilcase model.RATE_SUM, model.RATE_MAX, model.RATE_AVG, model.RATE_MIN:op := fmt.Sprintf("%s(value)", AggregateOperatorToSQLFunc[mq.AggregateOperator])subQuery := fmt.Sprintf(queryTmpl, groupTags, qp.Step, op, filterSubQuery, groupBy, groupTags)- query := `SELECT %s ts, ` + rateWithoutNegative + `as value FROM(%s)`+ query := `SELECT %s ts, ` + rateWithoutNegative + `as value FROM(%s) WHERE isNaN(value) = 0`query = fmt.Sprintf(query, groupTags, subQuery)return query, nilcase model.P05, model.P10, model.P20, model.P25, model.P50, model.P75, model.P90, model.P95, model.P99:@@ -235,7 +235,7 @@ func BuildMetricQuery(qp *model.QueryRangeParamsV2, mq *model.MetricQuery, tablesubQuery := fmt.Sprintf(queryTmpl, rateGroupTags, qp.Step, op, filterSubQuery, rateGroupBy, rateGroupTags,) // labels will be same so any should be fine- query := `SELECT %s ts, ` + rateWithoutNegative + ` as value FROM(%s)`+ query := `SELECT %s ts, ` + rateWithoutNegative + ` as value FROM(%s) WHERE isNaN(value) = 0`query = fmt.Sprintf(query, groupTags, subQuery)// filter out NaN values from the rate query as histogramQuantile doesn't support NaN valuesquery = fmt.Sprintf(`SELECT %s ts, sum(value) as value FROM (%s) GROUP BY %s HAVING isNaN(value) = 0 ORDER BY %s ts`, groupTags, query, groupBy, groupTags)