Fix trendValue/consolidateBy
This commit is contained in:
@@ -53,7 +53,7 @@ var filterFuncMap map[string]AggDataProcessingFunc
|
|||||||
|
|
||||||
var timeFuncMap map[string]PreProcessingFunc
|
var timeFuncMap map[string]PreProcessingFunc
|
||||||
|
|
||||||
var frontendFuncMap map[string]bool
|
var skippedFuncMap map[string]bool
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
seriesFuncMap = map[string]DataProcessingFunc{
|
seriesFuncMap = map[string]DataProcessingFunc{
|
||||||
@@ -87,11 +87,13 @@ func init() {
|
|||||||
"timeShift": applyTimeShiftPre,
|
"timeShift": applyTimeShiftPre,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Functions processing on the frontend
|
// Functions not processing here or processing on the frontend, skip it
|
||||||
frontendFuncMap = map[string]bool{
|
skippedFuncMap = map[string]bool{
|
||||||
"setAlias": true,
|
"setAlias": true,
|
||||||
"replaceAlias": true,
|
"replaceAlias": true,
|
||||||
"setAliasByRegex": true,
|
"setAliasByRegex": true,
|
||||||
|
"trendValue": true,
|
||||||
|
"consolidateBy": true,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -117,7 +119,7 @@ func applyFunctions(series []*timeseries.TimeSeriesData, functions []QueryFuncti
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
series = result
|
series = result
|
||||||
} else if _, ok := frontendFuncMap[f.Def.Name]; ok {
|
} else if _, ok := skippedFuncMap[f.Def.Name]; ok {
|
||||||
continue
|
continue
|
||||||
} else {
|
} else {
|
||||||
err := errFunctionNotSupported(f.Def.Name)
|
err := errFunctionNotSupported(f.Def.Name)
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ func (ds *ZabbixDatasourceInstance) queryNumericDataForItems(ctx context.Context
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
history, err := ds.getHistotyOrTrend(ctx, query, items, valueType)
|
history, err := ds.getHistotyOrTrend(ctx, query, items, consolidateBy)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@@ -101,7 +101,7 @@ func (ds *ZabbixDatasourceInstance) getTrendValueType(query *QueryModel) string
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (ds *ZabbixDatasourceInstance) getConsolidateBy(query *QueryModel) string {
|
func (ds *ZabbixDatasourceInstance) getConsolidateBy(query *QueryModel) string {
|
||||||
consolidateBy := "avg"
|
consolidateBy := ""
|
||||||
|
|
||||||
for _, fn := range query.Functions {
|
for _, fn := range query.Functions {
|
||||||
if fn.Def.Name == "consolidateBy" && len(fn.Params) > 0 {
|
if fn.Def.Name == "consolidateBy" && len(fn.Params) > 0 {
|
||||||
|
|||||||
Reference in New Issue
Block a user