File: scope_manager.rb

package info (click to toggle)
ruby-opentracing 0.5.0-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 160 kB
  • sloc: ruby: 158; makefile: 4; sh: 4
file content (35 lines) | stat: -rw-r--r-- 1,243 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
module OpenTracing
  # ScopeManager represents an OpenTracing ScopeManager
  #
  # See http://www.opentracing.io for more information.
  #
  # The ScopeManager interface abstracts both the activation of Span instances
  # via ScopeManager#activate and access to an active Span/Scope via
  # ScopeManager#active
  #
  class ScopeManager
    NOOP_INSTANCE = ScopeManager.new.freeze

    # Make a span instance active.
    #
    # @param span [Span] the Span that should become active
    # @param finish_on_close [Boolean] whether the Span should automatically be
    #   finished when Scope#close is called
    # @return [Scope] instance to control the end of the active period for the
    #  Span. It is a programming error to neglect to call Scope#close on the
    #  returned instance.
    def activate(span, finish_on_close: true)
      Scope::NOOP_INSTANCE
    end

    # @return [Scope] the currently active Scope which can be used to access the
    # currently active Span.
    #
    # If there is a non-null Scope, its wrapped Span becomes an implicit parent
    # (as Reference#CHILD_OF) of any newly-created Span at Tracer#start_active_span
    # or Tracer#start_span time.
    def active
      Scope::NOOP_INSTANCE
    end
  end
end