forked from rai-project/evaluation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
selectors.go
39 lines (33 loc) · 1016 Bytes
/
selectors.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package evaluation
import (
"github.com/pkg/errors"
model "github.com/uber/jaeger/model/json"
)
func findPredictStep(spans []model.Span) (model.Span, error) {
return findSpanByOperationName(spans, "PredictStep")
}
func findCPredict(spans []model.Span) (model.Span, error) {
return findSpanByOperationName(spans, "c_predict")
}
func findModelName(spans []model.Span) (string, error) {
predictSpan, err := findPredictStep(spans)
if err != nil {
return "", err
}
return getTagValueAsString(predictSpan, "model_name")
}
func findBatchSize(spans []model.Span) (int, error) {
predictSpan, err := findPredictStep(spans)
if err != nil {
return 0, err
}
return getTagValueAsInt(predictSpan, "batch_size")
}
func findSpanByOperationName(spans []model.Span, operationName string) (model.Span, error) {
for _, span := range spans {
if span.OperationName == operationName {
return span, nil
}
}
return model.Span{}, errors.Errorf("the span with operationName = %v was not found", operationName)
}