Exemplo n.º 1
0
 public async Task <DeliveryResult <Null, byte[]> > TransmitSpans(IEnumerable <Span> spans)
 {
     using (var stream = SerializationStreamManager.StreamManager.GetStream("Petabridge.Tracing.Zipkin.KafkaTransmitter"))
     {
         _serializer.Serialize(stream, spans);
         var outboundBytes = stream.ToArray();
         return(await _producer.ProduceAsync(_topicName, new Message <Null, byte[]>() { Key = null, Value = outboundBytes }).ConfigureAwait(false));
     }
 }
        public void SerializeSpans()
        {
            for (var i = 0; i < SpanCount; i++)
            {
                using (var mem = new MemoryStream())
                    _serializer.Serialize(mem, _testSpan);
            }

            _opsCounter.Increment(SpanCount);
        }
        public void VerifySerialization(ISpanSerializer serializer, byte[] expectedOutput, IEnumerable <Span> inputSpans,
                                        SerializationVerifier verifier)
        {
            var stream = new MemoryStream();

            serializer.Serialize(stream, inputSpans);
            var actualOutput = stream.ToArray();

            stream.Flush();
            stream.Dispose();
            verifier(actualOutput, expectedOutput);
        }
 public async Task <HttpResponseMessage> TransmitSpans(IEnumerable <Span> spans, TimeSpan timeout)
 {
     using (var stream = StreamManager.GetStream("Petabridge.Tracing.Zipkin.HttpTransmitter"))
     {
         _serializer.Serialize(stream, spans);
         var cts = new CancellationTokenSource(timeout);
         stream.Position = 0;
         var content = new StreamContent(stream);
         content.Headers.Add("Content-Type", MediaType);
         content.Headers.Add("Content-Length", stream.Length.ToString());
         return(await _client.PostAsync(Uri, content, cts.Token));
     }
 }