Skip to content

Commit a50761b

Browse files
authored
metricsql: add function histogram_fraction()
Add support for the histogram_fraction() function in MetricsQL. It is registered as a transform and recognized by the optimizer (arg index 2) so queries using it parse and optimize correctly. PR #59 Related to VictoriaMetrics/VictoriaMetrics#5346
1 parent 6ea382c commit a50761b

2 files changed

Lines changed: 2 additions & 1 deletion

File tree

optimizer.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -700,7 +700,7 @@ func getTransformArgIdxForOptimization(funcName string, args []Expr) int {
700700
return -1
701701
case "end", "now", "pi", "ru", "start", "step", "time":
702702
return -1
703-
case "limit_offset":
703+
case "limit_offset", "histogram_fraction":
704704
return 2
705705
case "buckets_limit", "histogram_quantile", "histogram_share", "range_quantile",
706706
"range_trim_outliers", "range_trim_spikes", "range_trim_zscore":

transform.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ var transformFuncs = map[string]bool{
3535
"exp": true,
3636
"floor": true,
3737
"histogram_avg": true,
38+
"histogram_fraction": true,
3839
"histogram_quantile": true,
3940
"histogram_quantiles": true,
4041
"histogram_share": true,

0 commit comments

Comments
 (0)