

def submit_packets(self, packets):
    if self.utf8_decoding:
        packets = unicode(packets, 'utf-8', errors='replace')
    for packet in packets.splitlines():
        if (not packet.strip()):
            continue
        if packet.startswith('_e'):
            self.event_count += 1
            event = self.parse_event_packet(packet)
            self.event(**event)
        elif packet.startswith('_sc'):
            self.service_check_count += 1
            service_check = self.parse_sc_packet(packet)
            self.service_check(**service_check)
        else:
            self.count += 1
            parsed_packets = self.parse_metric_packet(packet)
            for (name, value, mtype, tags, sample_rate) in parsed_packets:
                (hostname, device_name, tags) = self._extract_magic_tags(tags)
                self.submit_metric(name, value, mtype, tags=tags, hostname=hostname, device_name=device_name, sample_rate=sample_rate)

dataset/ETHPy150Open serverdensity/sd-agent/aggregator.py Aggregator.submit_packets/original