Class: Atatus::OpenTracing::Span Private
- Inherits:
-
Object
- Object
- Atatus::OpenTracing::Span
- Defined in:
- lib/atatus/opentracing.rb
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Instance Attribute Summary collapse
- #atatus_span ⇒ Object readonly private
Instance Method Summary collapse
- #context ⇒ Object private
-
#finish(end_time: Time.now) ⇒ Object
private
rubocop:enable Lint/UnusedMethodArgument.
- #get_baggage_item(_key) ⇒ Object private
-
#initialize(atatus_span, span_context) ⇒ Span
constructor
private
A new instance of Span.
-
#log_kv(timestamp: nil, **fields) ⇒ Object
private
rubocop:disable Lint/UnusedMethodArgument.
- #operation_name=(name) ⇒ Object private
- #set_baggage_item(_key, _value) ⇒ Object private
- #set_tag(key, val) ⇒ Object private
Constructor Details
#initialize(atatus_span, span_context) ⇒ Span
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Span.
27 28 29 30 |
# File 'lib/atatus/opentracing.rb', line 27 def initialize(atatus_span, span_context) @atatus_span = atatus_span @span_context = span_context end |
Instance Attribute Details
#atatus_span ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
32 33 34 |
# File 'lib/atatus/opentracing.rb', line 32 def atatus_span @atatus_span end |
Instance Method Details
#context ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
38 39 40 |
# File 'lib/atatus/opentracing.rb', line 38 def context @span_context end |
#finish(end_time: Time.now) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
rubocop:enable Lint/UnusedMethodArgument
85 86 87 88 89 90 91 92 93 94 95 96 97 98 |
# 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) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
67 68 69 70 71 72 73 |
# 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) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
rubocop:disable Lint/UnusedMethodArgument
76 77 78 79 80 81 82 |
# File 'lib/atatus/opentracing.rb', line 76 def log_kv(timestamp: nil, **fields) if (exception = fields[:'error.object']) Atatus.report exception elsif ( = fields[:message]) Atatus. end end |
#operation_name=(name) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
34 35 36 |
# File 'lib/atatus/opentracing.rb', line 34 def operation_name=(name) atatus_span.name = name end |
#set_baggage_item(_key, _value) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
61 62 63 64 65 |
# 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) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# 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 |