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
feat: hotfix check if limit is not zero (#3221)
Nityananda Gohain203eef8cde5e
diff --git a/pkg/query-service/app/logs/v3/query_builder.go b/pkg/query-service/app/logs/v3/query_builder.goindex 1b84f71fcc..4c6ee73bad 100644--- a/pkg/query-service/app/logs/v3/query_builder.go+++ b/pkg/query-service/app/logs/v3/query_builder.go@@ -398,6 +398,9 @@ func reduceQuery(query string, reduceTo v3.ReduceToOperator, aggregateOperator v}func addLimitToQuery(query string, limit uint64) string {+ if limit == 0 {+ return query+ }return fmt.Sprintf("%s LIMIT %d", query, limit)}diff --git a/pkg/query-service/app/logs/v3/query_builder_test.go b/pkg/query-service/app/logs/v3/query_builder_test.goindex 2e5f240dc6..361c1cefa7 100644--- a/pkg/query-service/app/logs/v3/query_builder_test.go+++ b/pkg/query-service/app/logs/v3/query_builder_test.go@@ -1140,6 +1140,39 @@ var testPrepLogsQueryData = []struct {ExpectedQuery: "SELECT timestamp, id, trace_id, span_id, trace_flags, severity_text, severity_number, body,CAST((attributes_string_key, attributes_string_value), 'Map(String, String)') as attributes_string,CAST((attributes_int64_key, attributes_int64_value), 'Map(String, Int64)') as attributes_int64,CAST((attributes_float64_key, attributes_float64_value), 'Map(String, Float64)') as attributes_float64,CAST((resources_string_key, resources_string_value), 'Map(String, String)') as resources_string from signoz_logs.distributed_logs where %s",Options: Options{IsLivetailQuery: true},},+ {+ Name: "Table query w/o limit",+ PanelType: v3.PanelTypeTable,+ Start: 1680066360726210000,+ End: 1680066458000000000,+ Step: 60,+ BuilderQuery: &v3.BuilderQuery{+ QueryName: "A",+ AggregateOperator: v3.AggregateOperatorCount,+ Expression: "A",+ Filters: &v3.FilterSet{Operator: "AND", Items: []v3.FilterItem{}},+ },+ TableName: "logs",+ ExpectedQuery: "SELECT now() as ts, toFloat64(count(*)) as value from signoz_logs.distributed_logs where (timestamp >= 1680066360726210000 AND timestamp <= 1680066458000000000) order by value DESC",+ Options: Options{},+ },+ {+ Name: "Table query with limit",+ PanelType: v3.PanelTypeTable,+ Start: 1680066360726210000,+ End: 1680066458000000000,+ Step: 60,+ BuilderQuery: &v3.BuilderQuery{+ QueryName: "A",+ AggregateOperator: v3.AggregateOperatorCount,+ Expression: "A",+ Filters: &v3.FilterSet{Operator: "AND", Items: []v3.FilterItem{}},+ Limit: 10,+ },+ TableName: "logs",+ ExpectedQuery: "SELECT now() as ts, toFloat64(count(*)) as value from signoz_logs.distributed_logs where (timestamp >= 1680066360726210000 AND timestamp <= 1680066458000000000) order by value DESC LIMIT 10",+ Options: Options{},+ },}func TestPrepareLogsQuery(t *testing.T) {