Expressions: Field names from refId (#29755)

so one can see which expression data came from when visualizing
This commit is contained in:
Kyle Brandt
2020-12-11 06:59:12 -05:00
committed by GitHub
parent a515c54404
commit 67372378ac
14 changed files with 100 additions and 98 deletions

View File

@@ -73,12 +73,12 @@ func Count(fv *data.Field) *float64 {
}
// Reduce turns the Series into a Number based on the given reduction function
func (s Series) Reduce(rFunc string) (Number, error) {
func (s Series) Reduce(refID, rFunc string) (Number, error) {
var l data.Labels
if s.GetLabels() != nil {
l = s.GetLabels().Copy()
}
number := NewNumber(fmt.Sprintf("%v_%v", rFunc, s.GetName()), l)
number := NewNumber(refID, l)
var f *float64
fVec := s.Frame.Fields[1]
switch rFunc {