mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-08-12 17:59:01 +08:00
fix: add validations for aggregates on logs/traces datasource (#2709)
This commit is contained in:
parent
81291c996f
commit
d67f709b8a
@ -374,6 +374,21 @@ var testBuildTracesQueryData = []struct {
|
||||
" from signoz_traces.distributed_signoz_index_v2 where (timestamp >= '1680066360726210000' AND timestamp <= '1680066458000000000')" +
|
||||
" group by ts order by ts",
|
||||
},
|
||||
{
|
||||
Name: "Test aggregate rate without aggregate attribute",
|
||||
Start: 1680066360726210000,
|
||||
End: 1680066458000000000,
|
||||
Step: 60,
|
||||
BuilderQuery: &v3.BuilderQuery{
|
||||
QueryName: "A",
|
||||
AggregateOperator: v3.AggregateOperatorRate,
|
||||
Expression: "A",
|
||||
},
|
||||
TableName: "signoz_traces.distributed_signoz_index_v2",
|
||||
ExpectedQuery: "SELECT toStartOfInterval(timestamp, INTERVAL 60 SECOND) AS ts, count()/60 as value from" +
|
||||
" signoz_traces.distributed_signoz_index_v2 where (timestamp >= '1680066360726210000' AND timestamp <=" +
|
||||
" '1680066458000000000') group by ts order by ts",
|
||||
},
|
||||
{
|
||||
Name: "Test aggregate count on fixed column of float64 type with filter",
|
||||
Start: 1680066360726210000,
|
||||
|
@ -104,10 +104,26 @@ func (a AggregateOperator) Validate() error {
|
||||
func (a AggregateOperator) RequireAttribute(dataSource DataSource) bool {
|
||||
switch dataSource {
|
||||
case DataSourceMetrics:
|
||||
switch a {
|
||||
case AggregateOperatorNoOp:
|
||||
return false
|
||||
default:
|
||||
return true
|
||||
}
|
||||
case DataSourceLogs:
|
||||
switch a {
|
||||
case AggregateOperatorNoOp,
|
||||
AggregateOperatorCount,
|
||||
AggregateOperatorCountDistinct:
|
||||
AggregateOperatorRate:
|
||||
return false
|
||||
default:
|
||||
return true
|
||||
}
|
||||
case DataSourceTraces:
|
||||
switch a {
|
||||
case AggregateOperatorNoOp,
|
||||
AggregateOperatorCount,
|
||||
AggregateOperatorRate:
|
||||
return false
|
||||
default:
|
||||
return true
|
||||
|
Loading…
x
Reference in New Issue
Block a user