예제 #1
0
        public void SerializeTo(Stream stream, Span span)
        {
            var thriftSpan = ConvertToThrift(span);

            var transport = new TStreamTransport(null, stream);
            var protocol  = new TBinaryProtocol(transport);

            protocol.WriteListBegin(new TList(TType.Struct, 1));
            thriftSpan.Write(protocol);
            protocol.WriteListEnd();
        }
예제 #2
0
        /// <summary>
        /// Serializes array of spans using Thrift protocol.
        /// </summary>
        public static void WriteSpans(Zipkin.Span[] spans, Stream outputStream)
        {
            var transport = new TStreamTransport(null, outputStream);
            var protocol  = new TBinaryProtocol(transport);

            protocol.WriteListBegin(new TList(TType.Struct, spans.Length));
            foreach (var span in spans)
            {
                var thrift = span.ToThrift();
                thrift.Write(protocol);
            }
            protocol.WriteListEnd();
            transport.Flush();
        }