module ElasticAPM::Fields::InstanceMethods

def empty?

def empty?
  self.class.fields.each do |key|
    next if send(key)
    next if optionals.include?(key)
    return true
  end
  false
end

def initialize(**attrs)

def initialize(**attrs)
  attrs.each do |key, value|
    self.send(:"#{key}=", value)
  end
  super()
end

def optionals

def optionals
  self.class.optionals
end

def to_h

def to_h
  self.class.fields.each_with_object({}) do |key, fields|
    fields[key] = send(key)
  end
end