-
Notifications
You must be signed in to change notification settings - Fork 2
/
tracer.go
57 lines (36 loc) · 1.6 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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
// Copyright 2022 Outreach Corporation. All Rights Reserved.
// Description: Declares a generic interface for a tracer with full tracing capabilities
package trace
import (
"context"
"net/http"
"github.com/getoutreach/gobox/pkg/log"
sdktrace "go.opentelemetry.io/otel/sdk/trace"
)
type tracer interface {
registerSpanProcessor(s sdktrace.SpanProcessor)
// Deprecated: Use initTracer() instead.
startTracing(serviceName string) error
initTracer(ctx context.Context, serviceName string) error
// Deprecated: Use closeTracer() instead.
endTracing()
closeTracer(ctx context.Context)
// Deprecated: Use startSpan() instead.
startTrace(ctx context.Context, name string) context.Context
id(ctx context.Context) string
startSpan(ctx context.Context, name string, opts ...SpanStartOption) context.Context
// Deprecated: Use startSpan() instead.
startSpanAsync(ctx context.Context, name string) context.Context
end(ctx context.Context)
addInfo(ctx context.Context, args ...log.Marshaler)
spanID(ctx context.Context) string
// Deprecated: Will be removed with full migration to OpenTelemetry.
// OpenTelemetry automatically handle adding parentID to traces
parentID(ctx context.Context) string
newTransport(http.RoundTripper) http.RoundTripper
newHandler(handler http.Handler, operation string) http.Handler
toHeaders(ctx context.Context) map[string][]string
contextFromHeaders(ctx context.Context, hdrs map[string][]string) context.Context
// fromHeaders is similar to contextFromHeaders + it starts a new span
fromHeaders(ctx context.Context, hdrs map[string][]string, name string) context.Context
}