class Airbrake::PerformanceNotifier

def serialize_resources(resources)

def serialize_resources(resources)
  resources.map do |resource, stats|
    resource_hash = resource.to_h.merge!(stats[:total].to_h)
    if resource.groups.any?
      group_stats = stats.reject { |name, _stat| name == :total }
      resource_hash['groups'] = group_stats.merge(group_stats) do |_name, stat|
        stat.to_h
      end
    end
    resource_hash
  end
end