Class: Trace::ZipkinSenderBase
- Inherits:
-
Object
- Object
- Trace::ZipkinSenderBase
show all
- Defined in:
- lib/zipkin-tracer/zipkin_sender_base.rb
Overview
This class is a base for senders sending information to Zipkin. It knows about zipkin types of annotations and send traces when the server is done with its request Senders dealing with zipkin should inherit from this class and implement the flush! method which actually sends the information
Instance Method Summary
collapse
Constructor Details
Returns a new instance of ZipkinSenderBase.
10
11
12
13
|
# File 'lib/zipkin-tracer/zipkin_sender_base.rb', line 10
def initialize(options = {})
@options = options
reset
end
|
Instance Method Details
#end_span(span, timestamp = Time.now) ⇒ Object
22
23
24
25
26
27
28
29
30
31
|
# File 'lib/zipkin-tracer/zipkin_sender_base.rb', line 22
def end_span(span, timestamp = Time.now)
span.close(timestamp)
return if skip_flush?(span)
flush!
reset
end
|
#flush! ⇒ Object
46
47
48
|
# File 'lib/zipkin-tracer/zipkin_sender_base.rb', line 46
def flush!
raise "not implemented"
end
|
#skip_flush?(span) ⇒ Boolean
#start_span(trace_id, name, timestamp = Time.now) ⇒ Object
33
34
35
36
37
38
|
# File 'lib/zipkin-tracer/zipkin_sender_base.rb', line 33
def start_span(trace_id, name, timestamp = Time.now)
span = Span.new(name, trace_id, timestamp)
span.local_endpoint = Trace.default_endpoint
store_span(trace_id, span)
span
end
|
#with_new_span(trace_id, name) ⇒ Object
15
16
17
18
19
20
|
# File 'lib/zipkin-tracer/zipkin_sender_base.rb', line 15
def with_new_span(trace_id, name)
span = start_span(trace_id, name)
result = yield span
end_span(span)
result
end
|