forked from kiali/kiali
-
Notifications
You must be signed in to change notification settings - Fork 0
/
jaeger.go
58 lines (49 loc) · 1.42 KB
/
jaeger.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
package business
import (
"time"
"github.com/kiali/kiali/jaeger"
)
type JaegerLoader = func() (jaeger.ClientInterface, error)
type JaegerService struct {
loader JaegerLoader
loaderErr error
jaeger jaeger.ClientInterface
businessLayer *Layer
}
func (in *JaegerService) client() (jaeger.ClientInterface, error) {
if in.jaeger != nil {
return in.jaeger, nil
} else if in.loaderErr != nil {
return nil, in.loaderErr
}
in.jaeger, in.loaderErr = in.loader()
return in.jaeger, in.loaderErr
}
func (in *JaegerService) GetJaegerSpans(namespace, service, startMicros, endMicros string) ([]jaeger.Span, error) {
client, err := in.client()
if err != nil {
return nil, err
}
return client.GetSpans(namespace, service, startMicros, endMicros)
}
func (in *JaegerService) GetJaegerTraces(ns string, srv string, query string) (traces *jaeger.JaegerResponse, err error) {
client, err := in.client()
if err != nil {
return nil, err
}
return client.GetTraces(ns, srv, query)
}
func (in *JaegerService) GetJaegerTraceDetail(traceID string) (trace *jaeger.JaegerResponse, err error) {
client, err := in.client()
if err != nil {
return nil, err
}
return client.GetTraceDetail(traceID)
}
func (in *JaegerService) GetErrorTraces(ns, srv string, duration time.Duration) (errorTraces int, err error) {
client, err := in.client()
if err != nil {
return 0, err
}
return client.GetErrorTraces(ns, srv, duration)
}