Added tracing span to evaluator.eval()

Signed-off-by: Marco Pracucci <marco@pracucci.com>
pull/8603/head
Marco Pracucci 2021-03-15 15:05:47 +01:00
parent 76750d2a96
commit 7bbab380b6
No known key found for this signature in database
GPG Key ID: 74C1BD403D2DF9B5
1 changed files with 5 additions and 0 deletions

View File

@ -19,6 +19,7 @@ import (
"context"
"fmt"
"math"
"reflect"
"regexp"
"runtime"
"sort"
@ -1125,6 +1126,10 @@ func (ev *evaluator) eval(expr parser.Expr) (parser.Value, storage.Warnings) {
}
numSteps := int((ev.endTimestamp-ev.startTimestamp)/ev.interval) + 1
// Create a new span to help investigate inner evaluation performances.
span, _ := opentracing.StartSpanFromContext(ev.ctx, stats.InnerEvalTime.SpanOperation()+" eval "+reflect.TypeOf(expr).String())
defer span.Finish()
switch e := expr.(type) {
case *parser.AggregateExpr:
unwrapParenExpr(&e.Param)