feat: bug fix for segregating entrypoint spans and root spans in span filtering (#7046)

This commit is contained in:
Ekansh Gupta 2025-02-06 13:26:18 +05:30 committed by GitHub
parent acd9b97ee3
commit 94c2398a08
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 2 additions and 2 deletions

View File

@ -229,7 +229,7 @@ func buildSpanScopeQuery(fs *v3.FilterSet) (string, error) {
query = "parent_span_id = '' "
return query, nil
} else if keyName == constants.SpanSearchScopeEntryPoint {
query = "((name, `resource_string_service$$name`) GLOBAL IN ( SELECT DISTINCT name, serviceName from " + constants.SIGNOZ_TRACE_DBNAME + "." + constants.SIGNOZ_TOP_LEVEL_OPERATIONS_TABLENAME + " )) "
query = "((name, `resource_string_service$$name`) GLOBAL IN ( SELECT DISTINCT name, serviceName from " + constants.SIGNOZ_TRACE_DBNAME + "." + constants.SIGNOZ_TOP_LEVEL_OPERATIONS_TABLENAME + " )) AND parent_span_id != '' "
return query, nil
} else {
return "", fmt.Errorf("invalid scope item type: %s", item.Key.Type)

View File

@ -566,7 +566,7 @@ func Test_buildTracesQuery(t *testing.T) {
},
},
want: "SELECT timestamp as timestamp_datetime, spanID, traceID, name as `name` from signoz_traces.distributed_signoz_index_v3 where (timestamp >= '1680066360726210000' AND timestamp <= '1680066458000000000') " +
"AND (ts_bucket_start >= 1680064560 AND ts_bucket_start <= 1680066458) AND ((name, `resource_string_service$$name`) GLOBAL IN ( SELECT DISTINCT name, serviceName from signoz_traces.distributed_top_level_operations )) order by timestamp ASC",
"AND (ts_bucket_start >= 1680064560 AND ts_bucket_start <= 1680066458) AND ((name, `resource_string_service$$name`) GLOBAL IN ( SELECT DISTINCT name, serviceName from signoz_traces.distributed_top_level_operations )) AND parent_span_id != '' order by timestamp ASC",
},
{
name: "test noop list view with root_spans",