Class: Datadog::CI::ConcurrentSpan
- Defined in:
- lib/datadog/ci/concurrent_span.rb
Overview
Represents a single part of a test run that can be safely shared between threads. Examples of shared objects are: TestSession, TestModule, TestSpan.
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from Span
Instance Method Summary collapse
-
#finish ⇒ void
Finishes the span.
-
#get_tag(key) ⇒ String
Gets tag value by key.
-
#initialize(tracer_span) ⇒ ConcurrentSpan
constructor
A new instance of ConcurrentSpan.
-
#set_metric(key, value) ⇒ void
Sets metric value by key.
-
#set_tag(key, value) ⇒ void
Sets tag value by key.
-
#set_tags(tags) ⇒ void
Sets multiple tags at once.
- #synchronize ⇒ Object
Methods inherited from Span
#failed!, #failed?, #id, #name, #passed!, #passed?, #service, #set_default_tags, #set_environment_runtime_tags, #skipped!, #skipped?, #span_type, #to_s, #undefined?
Constructor Details
#initialize(tracer_span) ⇒ ConcurrentSpan
Returns a new instance of ConcurrentSpan.
12 13 14 15 16 |
# File 'lib/datadog/ci/concurrent_span.rb', line 12 def initialize(tracer_span) super @mutex = Mutex.new end |
Instance Method Details
#finish ⇒ void
This method returns an undefined value.
Finishes the span. This method is thread-safe.
43 44 45 |
# File 'lib/datadog/ci/concurrent_span.rb', line 43 def finish synchronize { super } end |
#get_tag(key) ⇒ String
Gets tag value by key. This method is thread-safe.
21 22 23 |
# File 'lib/datadog/ci/concurrent_span.rb', line 21 def get_tag(key) synchronize { super } end |
#set_metric(key, value) ⇒ void
This method returns an undefined value.
Sets metric value by key. This method is thread-safe.
37 38 39 |
# File 'lib/datadog/ci/concurrent_span.rb', line 37 def set_metric(key, value) synchronize { super } end |
#set_tag(key, value) ⇒ void
This method returns an undefined value.
Sets tag value by key. This method is thread-safe.
29 30 31 |
# File 'lib/datadog/ci/concurrent_span.rb', line 29 def set_tag(key, value) synchronize { super } end |
#set_tags(tags) ⇒ void
This method returns an undefined value.
Sets multiple tags at once. This method is thread-safe.
50 51 52 |
# File 'lib/datadog/ci/concurrent_span.rb', line 50 def () synchronize { super } end |
#synchronize ⇒ Object
54 55 56 |
# File 'lib/datadog/ci/concurrent_span.rb', line 54 def synchronize @mutex.synchronize { yield } end |