go.undefinedlabs.com/scopeagent@v0.4.2/tracer/event.go (about) 1 package tracer 2 3 import "github.com/opentracing/opentracing-go" 4 5 // A SpanEvent is emitted when a mutating command is called on a Span. 6 type SpanEvent interface{} 7 8 // EventCreate is emitted when a Span is created. 9 type EventCreate struct{ OperationName string } 10 11 // EventTag is received when SetTag is called. 12 type EventTag struct { 13 Key string 14 Value interface{} 15 } 16 17 // EventBaggage is received when SetBaggageItem is called. 18 type EventBaggage struct { 19 Key, Value string 20 } 21 22 // EventLogFields is received when LogFields or LogKV is called. 23 type EventLogFields opentracing.LogRecord 24 25 // EventLog is received when Log (or one of its derivatives) is called. 26 // 27 // DEPRECATED 28 type EventLog opentracing.LogData 29 30 // EventFinish is received when Finish is called. 31 type EventFinish RawSpan 32 33 func (s *spanImpl) onCreate(opName string) { 34 if s.event != nil { 35 s.event(EventCreate{OperationName: opName}) 36 } 37 } 38 func (s *spanImpl) onTag(key string, value interface{}) { 39 if s.event != nil { 40 s.event(EventTag{Key: key, Value: value}) 41 } 42 } 43 func (s *spanImpl) onLog(ld opentracing.LogData) { 44 if s.event != nil { 45 s.event(EventLog(ld)) 46 } 47 } 48 func (s *spanImpl) onLogFields(lr opentracing.LogRecord) { 49 if s.event != nil { 50 s.event(EventLogFields(lr)) 51 } 52 } 53 func (s *spanImpl) onBaggage(key, value string) { 54 if s.event != nil { 55 s.event(EventBaggage{Key: key, Value: value}) 56 } 57 } 58 func (s *spanImpl) onFinish(sp RawSpan) { 59 if s.event != nil { 60 s.event(EventFinish(sp)) 61 } 62 }