class ElasticAPM::Metrics::SpanScopedSet

@api private

Public Instance Methods

collect() click to toggle source
Calls superclass method ElasticAPM::Metrics::Set#collect
# File lib/elastic_apm/metrics/span_scoped_set.rb, line 24
def collect
  super.tap do |sets|
    next unless sets

    sets.each do |set|
      move_transaction(set)
      move_span(set)
    end
  end
end

Private Instance Methods

move_span(set) click to toggle source
# File lib/elastic_apm/metrics/span_scoped_set.rb, line 46
def move_span(set)
  type = set.tags&.delete(:'span.type')
  subtype = set.tags&.delete(:'span.subtype')
  return unless type

  set.span = { type: type, subtype: subtype }
  set.tags = nil if set.tags.empty?
end
move_transaction(set) click to toggle source
# File lib/elastic_apm/metrics/span_scoped_set.rb, line 37
def move_transaction(set)
  name = set.tags&.delete(:'transaction.name')
  type = set.tags&.delete(:'transaction.type')
  return unless name || type

  set.transaction = { name: name, type: type }
  set.tags = nil if set.tags.empty?
end