module Datadog::Tracing::Contrib::SpanAttributeSchema

def self.set_peer_service_from_source(span, sources = [])

Returns a peer.service value if successfully set or not
Sets the source of where the information for peer.service was extracted from
If no values are found, it checks the default list for all spans before returning false for no result

based on the list of source tags passed as a parameter.
set_peer_service_from_source: Implements the extraction logic to determine the peer.service value
def self.set_peer_service_from_source(span, sources = [])
  # Filter out sources based on existence of peer.service tag
  sources = filter_peer_service_sources(span, sources)
  # Find a possible peer.service source from the list of source tags passed in
  sources.each do |source|
    source_val = span.get_tag(source)
    next unless not_empty_tag?(source_val)
    return source_val, source
  end
  false
end