Class: Labkit::Tracing::AbstractInstrumenter
- Inherits:
-
Object
- Object
- Labkit::Tracing::AbstractInstrumenter
show all
- Defined in:
- lib/labkit/tracing/abstract_instrumenter.rb
Overview
Instance Method Summary
collapse
Instance Method Details
#finish(_name, _id, payload) ⇒ Object
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
# File 'lib/labkit/tracing/abstract_instrumenter.rb', line 15
def finish(_name, _id, payload)
scope = scope_stack.pop
span = scope.span
Labkit::Tracing::TracingUtils.log_common_fields_on_span(span, span_name(payload))
exception = payload[:exception_object].presence || payload[:exception].presence
Labkit::Tracing::TracingUtils.log_exception_on_span(span, exception)
tags(payload).each do |k, v|
span.set_tag(k, v)
end
scope.close
end
|
#scope_stack ⇒ Object
33
34
35
|
# File 'lib/labkit/tracing/abstract_instrumenter.rb', line 33
def scope_stack
Thread.current[:_labkit_trace_scope_stack] ||= []
end
|
#span_name(_payload) ⇒ Object
37
38
39
|
# File 'lib/labkit/tracing/abstract_instrumenter.rb', line 37
def span_name(_payload)
raise "span_name not implemented"
end
|
#start(_name, _id, payload) ⇒ Object
9
10
11
12
13
|
# File 'lib/labkit/tracing/abstract_instrumenter.rb', line 9
def start(_name, _id, payload)
scope = OpenTracing.start_active_span(span_name(payload))
scope_stack.push scope
end
|
41
42
43
|
# File 'lib/labkit/tracing/abstract_instrumenter.rb', line 41
def tags(_payload)
{}
end
|