def collect(self, spanID, *annotations): self._log("collecting", str(len(annotations)), "annotations for", str(spanID)) packet = encode._collect(spanID, *annotations) buf = encode._msg(packet) totalSent = 0 while totalSent < len(buf): sent = self.sock.send(buf[totalSent:]) if sent == 0: raise RuntimeError("socket connection broken") totalSent = totalSent + sent
def writeMsg(self, msg): self.transport.write(encode._msg(msg))