-
Notifications
You must be signed in to change notification settings - Fork 174
/
tracer.go
43 lines (35 loc) · 1.16 KB
/
tracer.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
package module
import (
"context"
"time"
"github.com/opentracing/opentracing-go"
"github.com/onflow/flow-go/model/flow"
"github.com/onflow/flow-go/module/trace"
)
var _ Tracer = &trace.OpenTracer{}
// Tracer interface for tracers in flow. Uses open tracing span definitions
type Tracer interface {
ReadyDoneAware
StartSpan(entity flow.Identifier, spanName trace.SpanName, opts ...opentracing.StartSpanOption) opentracing.Span
FinishSpan(entity flow.Identifier, spanName trace.SpanName)
GetSpan(entity flow.Identifier, spanName trace.SpanName) (opentracing.Span, bool)
StartSpanFromContext(
ctx context.Context,
operationName trace.SpanName,
opts ...opentracing.StartSpanOption,
) (opentracing.Span, context.Context)
StartSpanFromParent(
span opentracing.Span,
operationName trace.SpanName,
opts ...opentracing.StartSpanOption,
) opentracing.Span
// RecordSpanFromParent records an span at finish time
// start time will be computed by reducing time.Now() - duration
RecordSpanFromParent(
span opentracing.Span,
operationName trace.SpanName,
duration time.Duration,
logs []opentracing.LogRecord,
opts ...opentracing.StartSpanOption,
)
}