-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: added series aggregation for group by with value type panel (#…
- Loading branch information
1 parent
dbe78e5
commit 5708079
Showing
6 changed files
with
242 additions
and
29 deletions.
There are no files selected for viewing
30 changes: 30 additions & 0 deletions
30
pkg/query-service/app/metrics/v4/helpers/series_agg_helper.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package helpers | ||
|
||
import ( | ||
"fmt" | ||
v3 "go.signoz.io/signoz/pkg/query-service/model/v3" | ||
) | ||
|
||
func AddSecondaryAggregation(seriesAggregator v3.SecondaryAggregation, query string) string { | ||
queryImpl := "SELECT %s as aggregated_value, ts" + | ||
" FROM (%s)" + | ||
" GROUP BY ts" + | ||
" ORDER BY ts" | ||
|
||
var op string | ||
switch seriesAggregator { | ||
case v3.SecondaryAggregationAvg: | ||
op = "avg(value)" | ||
query = fmt.Sprintf(queryImpl, op, query) | ||
case v3.SecondaryAggregationSum: | ||
op = "sum(value)" | ||
query = fmt.Sprintf(queryImpl, op, query) | ||
case v3.SecondaryAggregationMin: | ||
op = "min(value)" | ||
query = fmt.Sprintf(queryImpl, op, query) | ||
case v3.SecondaryAggregationMax: | ||
op = "max(value)" | ||
query = fmt.Sprintf(queryImpl, op, query) | ||
} | ||
return query | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters