Class: Jaeger::Client::Span
- Inherits:
-
Object
- Object
- Jaeger::Client::Span
- Defined in:
- lib/jaeger/client/span.rb
Instance Attribute Summary collapse
-
#context ⇒ Object
readonly
Returns the value of attribute context.
-
#logs ⇒ Object
readonly
Returns the value of attribute logs.
-
#operation_name ⇒ Object
Returns the value of attribute operation_name.
-
#start_time ⇒ Object
readonly
Returns the value of attribute start_time.
-
#tags ⇒ Object
readonly
Returns the value of attribute tags.
Instance Method Summary collapse
-
#finish(end_time: Time.now) ⇒ Object
Finish the Span.
-
#get_baggage_item(key) ⇒ Object
Get a baggage item.
-
#initialize(context, operation_name, collector, start_time: Time.now, tags: {}) ⇒ Span
constructor
Creates a new Span.
-
#log(timestamp: Time.now, **fields) ⇒ Object
Add a log entry to this span.
-
#set_baggage_item(key, value) ⇒ Object
Set a baggage item on the span.
-
#set_tag(key, value) ⇒ Object
Set a tag value on this span.
Constructor Details
#initialize(context, operation_name, collector, start_time: Time.now, tags: {}) ⇒ Span
Creates a new Jaeger::Client::Span
15 16 17 18 19 20 21 22 |
# File 'lib/jaeger/client/span.rb', line 15 def initialize(context, operation_name, collector, start_time: Time.now, tags: {}) @context = context @operation_name = operation_name @collector = collector @start_time = start_time @tags = @logs = [] end |
Instance Attribute Details
#context ⇒ Object (readonly)
Returns the value of attribute context.
6 7 8 |
# File 'lib/jaeger/client/span.rb', line 6 def context @context end |
#logs ⇒ Object (readonly)
Returns the value of attribute logs.
6 7 8 |
# File 'lib/jaeger/client/span.rb', line 6 def logs @logs end |
#operation_name ⇒ Object
Returns the value of attribute operation_name.
4 5 6 |
# File 'lib/jaeger/client/span.rb', line 4 def operation_name @operation_name end |
#start_time ⇒ Object (readonly)
Returns the value of attribute start_time.
6 7 8 |
# File 'lib/jaeger/client/span.rb', line 6 def start_time @start_time end |
#tags ⇒ Object (readonly)
Returns the value of attribute tags.
6 7 8 |
# File 'lib/jaeger/client/span.rb', line 6 def @tags end |
Instance Method Details
#finish(end_time: Time.now) ⇒ Object
Finish the Jaeger::Client::Span
61 62 63 |
# File 'lib/jaeger/client/span.rb', line 61 def finish(end_time: Time.now) @collector.send_span(self, end_time) end |
#get_baggage_item(key) ⇒ Object
Get a baggage item
46 47 48 |
# File 'lib/jaeger/client/span.rb', line 46 def get_baggage_item(key) nil end |
#log(timestamp: Time.now, **fields) ⇒ Object
Add a log entry to this span
54 55 56 |
# File 'lib/jaeger/client/span.rb', line 54 def log(timestamp: Time.now, **fields) @logs << {timestamp: , fields: fields} end |
#set_baggage_item(key, value) ⇒ Object
Set a baggage item on the span
37 38 39 |
# File 'lib/jaeger/client/span.rb', line 37 def set_baggage_item(key, value) self end |
#set_tag(key, value) ⇒ Object
Set a tag value on this span
a String, Numeric, or Boolean it will be encoded with to_s
29 30 31 |
# File 'lib/jaeger/client/span.rb', line 29 def set_tag(key, value) @tags = @tags.merge(key => value) end |