Fix trendValue/consolidateBy

This commit is contained in:
Alexander Zobnin
2021-05-28 11:38:31 +03:00
parent 6f9260f698
commit 4e6a77cad0
2 changed files with 8 additions and 6 deletions

View File

@@ -53,7 +53,7 @@ var filterFuncMap map[string]AggDataProcessingFunc
var timeFuncMap map[string]PreProcessingFunc
var frontendFuncMap map[string]bool
var skippedFuncMap map[string]bool
func init() {
seriesFuncMap = map[string]DataProcessingFunc{
@@ -87,11 +87,13 @@ func init() {
"timeShift": applyTimeShiftPre,
}
// Functions processing on the frontend
frontendFuncMap = map[string]bool{
// Functions not processing here or processing on the frontend, skip it
skippedFuncMap = map[string]bool{
"setAlias": true,
"replaceAlias": true,
"setAliasByRegex": true,
"trendValue": true,
"consolidateBy": true,
}
}
@@ -117,7 +119,7 @@ func applyFunctions(series []*timeseries.TimeSeriesData, functions []QueryFuncti
return nil, err
}
series = result
} else if _, ok := frontendFuncMap[f.Def.Name]; ok {
} else if _, ok := skippedFuncMap[f.Def.Name]; ok {
continue
} else {
err := errFunctionNotSupported(f.Def.Name)

View File

@@ -73,7 +73,7 @@ func (ds *ZabbixDatasourceInstance) queryNumericDataForItems(ctx context.Context
return nil, err
}
history, err := ds.getHistotyOrTrend(ctx, query, items, valueType)
history, err := ds.getHistotyOrTrend(ctx, query, items, consolidateBy)
if err != nil {
return nil, err
}
@@ -101,7 +101,7 @@ func (ds *ZabbixDatasourceInstance) getTrendValueType(query *QueryModel) string
}
func (ds *ZabbixDatasourceInstance) getConsolidateBy(query *QueryModel) string {
consolidateBy := "avg"
consolidateBy := ""
for _, fn := range query.Functions {
if fn.Def.Name == "consolidateBy" && len(fn.Params) > 0 {