class Atatus::OpenTracing::Span
@api private
Attributes
atatus_span[R]
Public Class Methods
new(atatus_span, span_context)
click to toggle source
# File lib/atatus/opentracing.rb, line 27 def initialize(atatus_span, span_context) @atatus_span = atatus_span @span_context = span_context end
Public Instance Methods
context()
click to toggle source
# File lib/atatus/opentracing.rb, line 38 def context @span_context end
finish(end_time: Time.now)
click to toggle source
rubocop:enable Lint/UnusedMethodArgument
# File lib/atatus/opentracing.rb, line 85 def finish(end_time: Time.now) return unless (agent = Atatus.agent) atatus_span.done clock_end: Util.micros(end_time) case atatus_span when Atatus::Transaction agent.instrumenter.current_transaction = nil when Atatus::Span agent.instrumenter.current_spans.delete(atatus_span) end agent.enqueue atatus_span end
get_baggage_item(_key)
click to toggle source
# File lib/atatus/opentracing.rb, line 67 def get_baggage_item(_key) Atatus.agent.config.logger.warn( 'Baggage is not supported by Atatus' ) nil end
log_kv(timestamp: nil, **fields)
click to toggle source
rubocop:disable Lint/UnusedMethodArgument
# File lib/atatus/opentracing.rb, line 76 def log_kv(timestamp: nil, **fields) if (exception = fields[:'error.object']) Atatus.report exception elsif (message = fields[:message]) Atatus.report_message message end end
operation_name=(name)
click to toggle source
# File lib/atatus/opentracing.rb, line 34 def operation_name=(name) atatus_span.name = name end
set_baggage_item(_key, _value)
click to toggle source
# File lib/atatus/opentracing.rb, line 61 def set_baggage_item(_key, _value) Atatus.agent.config.logger.warn( 'Baggage is not supported by Atatus' ) end
set_tag(key, val)
click to toggle source
# File lib/atatus/opentracing.rb, line 42 def set_tag(key, val) if atatus_span.is_a?(Transaction) case key.to_s when 'type' atatus_span.type = val when 'result' atatus_span.result = val when /user\.(\w+)/ set_user_value($1, val) else atatus_span.context.labels[key] = val end else atatus_span.context.labels[key] = val end self end
Private Instance Methods
set_user_value(key, value)
click to toggle source
# File lib/atatus/opentracing.rb, line 102 def set_user_value(key, value) return unless atatus_span.is_a?(Transaction) setter = :"#{key}=" return unless atatus_span.context.user.respond_to?(setter) atatus_span.context.user.send(setter, value) end