-
Notifications
You must be signed in to change notification settings - Fork 178
/
span.go
132 lines (108 loc) · 3 KB
/
span.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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
// Code generated by mockery v2.13.0. DO NOT EDIT.
package mock
import (
attribute "go.opentelemetry.io/otel/attribute"
codes "go.opentelemetry.io/otel/codes"
mock "github.com/stretchr/testify/mock"
trace "go.opentelemetry.io/otel/trace"
)
// Span is an autogenerated mock type for the Span type
type Span struct {
mock.Mock
}
// AddEvent provides a mock function with given fields: name, options
func (_m *Span) AddEvent(name string, options ...trace.EventOption) {
_va := make([]interface{}, len(options))
for _i := range options {
_va[_i] = options[_i]
}
var _ca []interface{}
_ca = append(_ca, name)
_ca = append(_ca, _va...)
_m.Called(_ca...)
}
// End provides a mock function with given fields: options
func (_m *Span) End(options ...trace.SpanEndOption) {
_va := make([]interface{}, len(options))
for _i := range options {
_va[_i] = options[_i]
}
var _ca []interface{}
_ca = append(_ca, _va...)
_m.Called(_ca...)
}
// IsRecording provides a mock function with given fields:
func (_m *Span) IsRecording() bool {
ret := _m.Called()
var r0 bool
if rf, ok := ret.Get(0).(func() bool); ok {
r0 = rf()
} else {
r0 = ret.Get(0).(bool)
}
return r0
}
// RecordError provides a mock function with given fields: err, options
func (_m *Span) RecordError(err error, options ...trace.EventOption) {
_va := make([]interface{}, len(options))
for _i := range options {
_va[_i] = options[_i]
}
var _ca []interface{}
_ca = append(_ca, err)
_ca = append(_ca, _va...)
_m.Called(_ca...)
}
// SetAttributes provides a mock function with given fields: kv
func (_m *Span) SetAttributes(kv ...attribute.KeyValue) {
_va := make([]interface{}, len(kv))
for _i := range kv {
_va[_i] = kv[_i]
}
var _ca []interface{}
_ca = append(_ca, _va...)
_m.Called(_ca...)
}
// SetName provides a mock function with given fields: name
func (_m *Span) SetName(name string) {
_m.Called(name)
}
// SetStatus provides a mock function with given fields: code, description
func (_m *Span) SetStatus(code codes.Code, description string) {
_m.Called(code, description)
}
// SpanContext provides a mock function with given fields:
func (_m *Span) SpanContext() trace.SpanContext {
ret := _m.Called()
var r0 trace.SpanContext
if rf, ok := ret.Get(0).(func() trace.SpanContext); ok {
r0 = rf()
} else {
r0 = ret.Get(0).(trace.SpanContext)
}
return r0
}
// TracerProvider provides a mock function with given fields:
func (_m *Span) TracerProvider() trace.TracerProvider {
ret := _m.Called()
var r0 trace.TracerProvider
if rf, ok := ret.Get(0).(func() trace.TracerProvider); ok {
r0 = rf()
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(trace.TracerProvider)
}
}
return r0
}
type NewSpanT interface {
mock.TestingT
Cleanup(func())
}
// NewSpan creates a new instance of Span. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
func NewSpan(t NewSpanT) *Span {
mock := &Span{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}