Module: SpanExtension

Included in:
OpenTelemetry::SDK::Trace::Span
Defined in:
lib/epsagon.rb

Constant Summary collapse

BLANKS =
[nil, [], '']

Instance Method Summary collapse

Instance Method Details

#initialize(*args) ⇒ Object



158
159
160
161
162
163
164
165
166
# File 'lib/epsagon.rb', line 158

def initialize(*args)
  super(*args)
  if @attributes
    @attributes = Hash[@attributes.select {|k,v| not BLANKS.include? v}.map { |k,v|
      v = Util.prepare_attr(k, v, Epsagon.get_config[:max_attribute_size], Epsagon.get_config[:ignored_keys])
      [k, v] if v
    }.compact]
  end
end

#set_attribute(key, value) ⇒ Object



151
152
153
154
155
156
# File 'lib/epsagon.rb', line 151

def set_attribute(key, value)
  unless BLANKS.include?(value)
    value = Util.prepare_attr(key, value, Epsagon.get_config[:max_attribute_size], Epsagon.get_config[:ignored_keys])
    super(key, value) if value
  end
end

#set_mapping_attribute(key, value) ⇒ Object



146
147
148
149
# File 'lib/epsagon.rb', line 146

def set_mapping_attribute(key, value)
  value = Util.prepare_attr(key, value, Epsagon.get_config[:max_attribute_size], Epsagon.get_config[:ignored_keys])
  set_attribute(key, value) if value
end