mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-08-12 19:39:02 +08:00
feat: handle static fields correcty in aggreagte attribute keys (#2598)
This commit is contained in:
parent
2e4f0cfc33
commit
9557cb2f70
@ -3803,6 +3803,7 @@ func (r *ClickHouseReader) GetLogAggregateAttributes(ctx context.Context, req *v
|
|||||||
var err error
|
var err error
|
||||||
var rows driver.Rows
|
var rows driver.Rows
|
||||||
var response v3.AggregateAttributeResponse
|
var response v3.AggregateAttributeResponse
|
||||||
|
var stringAllowed bool
|
||||||
|
|
||||||
where := ""
|
where := ""
|
||||||
switch req.Operator {
|
switch req.Operator {
|
||||||
@ -3810,6 +3811,7 @@ func (r *ClickHouseReader) GetLogAggregateAttributes(ctx context.Context, req *v
|
|||||||
v3.AggregateOperatorCountDistinct,
|
v3.AggregateOperatorCountDistinct,
|
||||||
v3.AggregateOpeatorCount:
|
v3.AggregateOpeatorCount:
|
||||||
where = "tagKey ILIKE $1"
|
where = "tagKey ILIKE $1"
|
||||||
|
stringAllowed = true
|
||||||
case
|
case
|
||||||
v3.AggregateOperatorRateSum,
|
v3.AggregateOperatorRateSum,
|
||||||
v3.AggregateOperatorRateMax,
|
v3.AggregateOperatorRateMax,
|
||||||
@ -3830,6 +3832,7 @@ func (r *ClickHouseReader) GetLogAggregateAttributes(ctx context.Context, req *v
|
|||||||
v3.AggregateOperatorMin,
|
v3.AggregateOperatorMin,
|
||||||
v3.AggregateOperatorMax:
|
v3.AggregateOperatorMax:
|
||||||
where = "tagKey ILIKE $1 AND (tagDataType='int64' or tagDataType='float64')"
|
where = "tagKey ILIKE $1 AND (tagDataType='int64' or tagDataType='float64')"
|
||||||
|
stringAllowed = false
|
||||||
case
|
case
|
||||||
v3.AggregateOperatorNoOp:
|
v3.AggregateOperatorNoOp:
|
||||||
return &v3.AggregateAttributeResponse{}, nil
|
return &v3.AggregateAttributeResponse{}, nil
|
||||||
@ -3868,10 +3871,12 @@ func (r *ClickHouseReader) GetLogAggregateAttributes(ctx context.Context, req *v
|
|||||||
response.AttributeKeys = append(response.AttributeKeys, key)
|
response.AttributeKeys = append(response.AttributeKeys, key)
|
||||||
}
|
}
|
||||||
// add other attributes
|
// add other attributes
|
||||||
for _, f := range constants.StaticFieldsLogsV3 {
|
for _, field := range constants.StaticFieldsLogsV3 {
|
||||||
if len(req.SearchText) == 0 || strings.Contains(f.Key, req.SearchText) {
|
if !stringAllowed && field.DataType == v3.AttributeKeyDataTypeString {
|
||||||
f.IsColumn = isColumn(statements[0].Statement, f.Key)
|
continue
|
||||||
response.AttributeKeys = append(response.AttributeKeys, f)
|
} else if len(req.SearchText) == 0 || strings.Contains(field.Key, req.SearchText) {
|
||||||
|
field.IsColumn = isColumn(statements[0].Statement, field.Key)
|
||||||
|
response.AttributeKeys = append(response.AttributeKeys, field)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user