mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-08-12 22:39:10 +08:00
fix: update clauses
Signed-off-by: Shivanshu Raj Shrivastava <shivanshu1333@gmail.com>
This commit is contained in:
parent
e65fcab186
commit
1c8a6e77cc
@ -9,11 +9,15 @@ import (
|
|||||||
"github.com/SigNoz/signoz/pkg/types/tracefunneltypes"
|
"github.com/SigNoz/signoz/pkg/types/tracefunneltypes"
|
||||||
)
|
)
|
||||||
|
|
||||||
// sanitizeClause adds AND prefix to non-empty clauses
|
// sanitizeClause adds AND prefix to non-empty clauses if not already present
|
||||||
func sanitizeClause(clause string) string {
|
func sanitizeClause(clause string) string {
|
||||||
if clause == "" {
|
if clause == "" {
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
// Check if clause already starts with AND
|
||||||
|
if strings.HasPrefix(strings.TrimSpace(clause), "AND") {
|
||||||
|
return clause
|
||||||
|
}
|
||||||
return "AND " + clause
|
return "AND " + clause
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -153,7 +153,6 @@ func BuildTracesFilter(fs *v3.FilterSet) (string, error) {
|
|||||||
|
|
||||||
if fs != nil && len(fs.Items) != 0 {
|
if fs != nil && len(fs.Items) != 0 {
|
||||||
for _, item := range fs.Items {
|
for _, item := range fs.Items {
|
||||||
|
|
||||||
val := item.Value
|
val := item.Value
|
||||||
// generate the key
|
// generate the key
|
||||||
columnName := getColumnName(item.Key)
|
columnName := getColumnName(item.Key)
|
||||||
@ -199,9 +198,7 @@ func BuildTracesFilter(fs *v3.FilterSet) (string, error) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
queryString := strings.Join(conditions, " AND ")
|
return strings.Join(conditions, " AND "), nil
|
||||||
|
|
||||||
return queryString, nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func handleEmptyValuesInGroupBy(groupBy []v3.AttributeKey) (string, error) {
|
func handleEmptyValuesInGroupBy(groupBy []v3.AttributeKey) (string, error) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user