Beispiel #1
0
func (e *encoderDecoder) marshal(tStruct thrift.TStruct) ([]byte, error) {
	tMemoryBuffer := thrift.NewTMemoryBuffer()
	tProtocol := e.tProtocolFactory.GetProtocol(tMemoryBuffer)
	if err := tStruct.Write(tProtocol); err != nil {
		return nil, err
	}
	return tMemoryBuffer.Bytes(), nil
}
Beispiel #2
0
func SerializeSpan(s *zipkincore.Span) ([]byte, error) {
	t := thrift.NewTMemoryBuffer()
	p := thrift.NewTBinaryProtocolTransport(t)
	err := s.Write(p)
	if err != nil {
		return nil, err
	}
	return t.Buffer.Bytes(), nil
}
Beispiel #3
0
func (c *UDPCollector) send(s *zipkin.Span) error {
	t := thrift.NewTMemoryBuffer()
	p := thrift.NewTBinaryProtocolTransport(t)
	err := s.Write(p)
	if err != nil {
		return err
	}
	_, err = c.conn.WriteToUDP(t.Buffer.Bytes(), c.addr)
	return err
}
Beispiel #4
0
// Collect will serialize and send a zipkin.Span to the configured Scribe
// endpoint
func (c *ScribeCollector) Collect(s *zipkin.Span) {
	t := thrift.NewTMemoryBuffer()
	p := thrift.NewTBinaryProtocolTransport(t)
	err := s.Write(p)
	if err != nil {
		logger.Errore(err)
	} else {
		logger.Errore(c.CollectSerialized(t.Buffer.Bytes()))
	}
}