mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-08-11 17:59:09 +08:00
feat: Allow users to search spans with status code regex (#249)
This commit is contained in:
parent
3acef9c86a
commit
b5b0725cc4
@ -481,6 +481,7 @@ const _TraceFilter = (props: TraceFilterProps) => {
|
||||
<Select style={{ width: 120, textAlign: "center" }}>
|
||||
<Option value="equals">EQUAL</Option>
|
||||
<Option value="contains">CONTAINS</Option>
|
||||
<Option value="regex">REGEX</Option>
|
||||
</Select>
|
||||
</FormItem>
|
||||
|
||||
|
@ -4,7 +4,7 @@ import { ActionTypes } from "./types";
|
||||
export interface TagItem {
|
||||
key: string;
|
||||
value: string;
|
||||
operator: "equals" | "contains";
|
||||
operator: "equals" | "contains" | "regex";
|
||||
}
|
||||
|
||||
export interface LatencyValue {
|
||||
|
@ -244,11 +244,14 @@ func (r *ClickHouseReader) SearchSpans(ctx context.Context, queryParams *model.S
|
||||
if item.Operator == "equals" {
|
||||
query = query + " AND has(tags, ?)"
|
||||
args = append(args, fmt.Sprintf("%s:%s", item.Key, item.Value))
|
||||
|
||||
} else if item.Operator == "contains" {
|
||||
query = query + " AND tagsValues[indexOf(tagsKeys, ?)] ILIKE ?"
|
||||
args = append(args, item.Key)
|
||||
args = append(args, fmt.Sprintf("%%%s%%", item.Value))
|
||||
} else if item.Operator == "regex" {
|
||||
query = query + " AND match(tagsValues[indexOf(tagsKeys, ?)], ?)"
|
||||
args = append(args, item.Key)
|
||||
args = append(args, item.Value)
|
||||
} else if item.Operator == "isnotnull" {
|
||||
query = query + " AND has(tagsKeys, ?)"
|
||||
args = append(args, item.Key)
|
||||
@ -674,11 +677,14 @@ func (r *ClickHouseReader) SearchSpansAggregate(ctx context.Context, queryParams
|
||||
if item.Operator == "equals" {
|
||||
query = query + " AND has(tags, ?)"
|
||||
args = append(args, fmt.Sprintf("%s:%s", item.Key, item.Value))
|
||||
|
||||
} else if item.Operator == "contains" {
|
||||
query = query + " AND tagsValues[indexOf(tagsKeys, ?)] ILIKE ?"
|
||||
args = append(args, item.Key)
|
||||
args = append(args, fmt.Sprintf("%%%s%%", item.Value))
|
||||
} else if item.Operator == "regex" {
|
||||
query = query + " AND match(tagsValues[indexOf(tagsKeys, ?)], ?)"
|
||||
args = append(args, item.Key)
|
||||
args = append(args, item.Value)
|
||||
} else if item.Operator == "isnotnull" {
|
||||
query = query + " AND has(tagsKeys, ?)"
|
||||
args = append(args, item.Key)
|
||||
|
Loading…
x
Reference in New Issue
Block a user