def toPacket(self):
     stringMeta = TStringMetaData(agentId=self.agentId,
                                  agentStartTime=self.agentStartTime,
                                  stringId=self.apiId,
                                  stringValue=self.value)
     TCLogger.debug("generator stringMate:%s", stringMeta)
     body = CollectorPro.obj2bin(stringMeta, STRING_META_DATA)
     packet = Packet(PacketType.APPLICATION_REQUEST, CollectorPro.getCurReqCount(), len(body), body)
     return packet
 def toPacket(self):
     apiMeta = TApiMetaData(agentId=self.agentId,
                            agentStartTime=self.agentStartTime,
                            apiId=self.apiId,
                            type=self.type,
                            apiInfo=self.name)
     TCLogger.debug("generator ThriftAPIMeta:%s", apiMeta)
     body = CollectorPro.obj2bin(apiMeta, API_META_DATA)
     packet = Packet(PacketType.APPLICATION_REQUEST, CollectorPro.getCurReqCount(), len(body), body)
     return packet
 def sendState(self, layer):
     self._upDateCurState()
     body = CollectorPro.obj2bin(self.stateBatch, AGENT_STAT_BATCH)
     TCLogger.debug("send state:%s", self.stateBatch)
     self.trans_layer.sendData(body)