File: span.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 (68 lines) | stat: -rw-r--r-- 2,001 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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
module OpenTracing
  # Span represents an OpenTracing Span
  #
  # See http://www.opentracing.io for more information.
  class Span
    NOOP_INSTANCE = Span.new.freeze

    # Set the name of the operation
    #
    # @param [String] name
    def operation_name=(name); end

    # Span Context
    #
    # @return [SpanContext]
    def context
      SpanContext::NOOP_INSTANCE
    end

    # Set a tag value on this span
    # @param key [String] the key of the tag
    # @param value [String, Numeric, Boolean] the value of the tag. If it's not
    # a String, Numeric, or Boolean it will be encoded with to_s
    def set_tag(key, value)
      self
    end

    # Set a baggage item on the span
    # @param key [String] the key of the baggage item
    # @param value [String] the value of the baggage item
    def set_baggage_item(key, value)
      self
    end

    # Get a baggage item
    # @param key [String] the key of the baggage item
    # @return [String] value of the baggage item
    def get_baggage_item(key)
      nil
    end

    # @deprecated Use {#log_kv} instead.
    # Reason: event is an optional standard log field defined in spec and not required.  Also,
    # method name {#log_kv} is more consistent with other language implementations such as Python and Go.
    #
    # Add a log entry to this span
    # @param event [String] event name for the log
    # @param timestamp [Time] time of the log
    # @param fields [Hash{Symbol=>Object}] Additional information to log
    def log(event: nil, timestamp: Time.now, **fields)
      warn 'Span#log is deprecated.  Please use Span#log_kv instead.'
      nil
    end

    # Add a log entry to this span
    # @param timestamp [Time] time of the log
    # @param fields [Hash{Symbol=>Object}] Additional information to log
    def log_kv(timestamp: Time.now, **fields)
      nil
    end

    # Finish the {Span}
    # @param end_time [Time] custom end time, if not now
    def finish(end_time: Time.now)
      nil
    end
  end
end