File: event.go

package info (click to toggle)
golang-github-opentracing-basictracer-go 1.1.0-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 240 kB
  • sloc: makefile: 24
file content (62 lines) | stat: -rw-r--r-- 1,469 bytes parent folder | download
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
package basictracer

import "github.com/opentracing/opentracing-go"

// A SpanEvent is emitted when a mutating command is called on a Span.
type SpanEvent interface{}

// EventCreate is emitted when a Span is created.
type EventCreate struct{ OperationName string }

// EventTag is received when SetTag is called.
type EventTag struct {
	Key   string
	Value interface{}
}

// EventBaggage is received when SetBaggageItem is called.
type EventBaggage struct {
	Key, Value string
}

// EventLogFields is received when LogFields or LogKV is called.
type EventLogFields opentracing.LogRecord

// EventLog is received when Log (or one of its derivatives) is called.
//
// DEPRECATED
type EventLog opentracing.LogData

// EventFinish is received when Finish is called.
type EventFinish RawSpan

func (s *spanImpl) onCreate(opName string) {
	if s.event != nil {
		s.event(EventCreate{OperationName: opName})
	}
}
func (s *spanImpl) onTag(key string, value interface{}) {
	if s.event != nil {
		s.event(EventTag{Key: key, Value: value})
	}
}
func (s *spanImpl) onLog(ld opentracing.LogData) {
	if s.event != nil {
		s.event(EventLog(ld))
	}
}
func (s *spanImpl) onLogFields(lr opentracing.LogRecord) {
	if s.event != nil {
		s.event(EventLogFields(lr))
	}
}
func (s *spanImpl) onBaggage(key, value string) {
	if s.event != nil {
		s.event(EventBaggage{Key: key, Value: value})
	}
}
func (s *spanImpl) onFinish(sp RawSpan) {
	if s.event != nil {
		s.event(EventFinish(sp))
	}
}