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: proper formatting for noop operator in logs (#3086)
Nityananda Gohainc51a15f1e890
diff --git a/pkg/query-service/app/logs/v3/query_builder.go b/pkg/query-service/app/logs/v3/query_builder.goindex 1e49250865..baf2a6c193 100644--- a/pkg/query-service/app/logs/v3/query_builder.go+++ b/pkg/query-service/app/logs/v3/query_builder.go@@ -244,7 +244,7 @@ func buildLogsQuery(panelType v3.PanelType, start, end, step int64, mq *v3.Buildquery := fmt.Sprintf(queryTmpl, step, op, filterSubQuery, groupBy, having, orderBy)return query, nilcase v3.AggregateOperatorNoOp:- queryTmpl := constants.LogsSQLSelect + "from signoz_logs.distributed_logs where %s %sorder by %s"+ queryTmpl := constants.LogsSQLSelect + "from signoz_logs.distributed_logs where %s%s order by %s"query := fmt.Sprintf(queryTmpl, timeFilter, filterSubQuery, orderBy)return query, nildefault:diff --git a/pkg/query-service/app/logs/v3/query_builder_test.go b/pkg/query-service/app/logs/v3/query_builder_test.goindex 2712b8a874..8fab8653e2 100644--- a/pkg/query-service/app/logs/v3/query_builder_test.go+++ b/pkg/query-service/app/logs/v3/query_builder_test.go@@ -617,13 +617,33 @@ var testBuildLogsQueryData = []struct {AggregateOperator: v3.AggregateOperatorNoOp,Expression: "A",Filters: &v3.FilterSet{Operator: "AND", Items: []v3.FilterItem{}},- OrderBy: []v3.OrderBy{{ColumnName: "method", Order: "ASC", IsColumn: true}},+ OrderBy: []v3.OrderBy{{ColumnName: "method", DataType: v3.AttributeKeyDataTypeString, Order: "ASC", IsColumn: true}},},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 (timestamp >= 1680066360726210000 AND timestamp <= 1680066458000000000) order by method ASC",},+ {+ Name: "Test Noop with filter",+ PanelType: v3.PanelTypeList,+ Start: 1680066360726210000,+ End: 1680066458000000000,+ Step: 60,+ BuilderQuery: &v3.BuilderQuery{+ SelectColumns: []v3.AttributeKey{},+ QueryName: "A",+ AggregateOperator: v3.AggregateOperatorNoOp,+ Expression: "A",+ Filters: &v3.FilterSet{Operator: "AND", Items: []v3.FilterItem{+ {Key: v3.AttributeKey{Key: "severity_number", DataType: v3.AttributeKeyDataTypeInt64, IsColumn: true}, Operator: "!=", Value: 0},+ }},+ },+ 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 (timestamp >= 1680066360726210000 AND timestamp <= 1680066458000000000) AND severity_number != 0 order by timestamp",+ },{Name: "Test aggregate with having clause",PanelType: v3.PanelTypeGraph,