Class: Instana::Span

Inherits:
Object
  • Object
show all
Defined in:
lib/instana/tracing/span.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ Span

Returns a new instance of Span.



5
6
7
# File 'lib/instana/tracing/span.rb', line 5

def initialize(data)
  @data = data
end

Instance Attribute Details

#parentObject

Returns the value of attribute parent.



3
4
5
# File 'lib/instana/tracing/span.rb', line 3

def parent
  @parent
end

Instance Method Details

#[](key) ⇒ Object



33
34
35
# File 'lib/instana/tracing/span.rb', line 33

def [](key)
  @data[key.to_sym]
end

#[]=(key, value) ⇒ Object



37
38
39
# File 'lib/instana/tracing/span.rb', line 37

def []=(key, value)
  @data[key.to_sym] = value
end

#custom?Boolean

Returns:

  • (Boolean)


49
50
51
# File 'lib/instana/tracing/span.rb', line 49

def custom?
  @data[:n] == :sdk
end

#durationObject



25
26
27
# File 'lib/instana/tracing/span.rb', line 25

def duration
  @data[:d]
end

#idObject



9
10
11
# File 'lib/instana/tracing/span.rb', line 9

def id
  @data[:s]
end

#is_root?Boolean

Returns:

  • (Boolean)


29
30
31
# File 'lib/instana/tracing/span.rb', line 29

def is_root?
  @data[:s] == @data[:t]
end

#key?(k) ⇒ Boolean

Returns:

  • (Boolean)


41
42
43
# File 'lib/instana/tracing/span.rb', line 41

def key?(k)
  @data.key?(k.to_sym)
end

#nameObject



17
18
19
20
21
22
23
# File 'lib/instana/tracing/span.rb', line 17

def name
  if custom?
    @data[:data][:sdk][:name]
  else
    @data[:n]
  end
end

#parent_idObject



13
14
15
# File 'lib/instana/tracing/span.rb', line 13

def parent_id
  @data[:p]
end

#rawObject



45
46
47
# File 'lib/instana/tracing/span.rb', line 45

def raw
  @data
end