示例#1
0
        protected override async Task <int> SendAsync(List <JaegerSpan> spans, CancellationToken cancellationToken)
        {
            var batch = new JaegerBatch(_process, spans);
            await _agentClient.emitBatchAsync(batch, cancellationToken);

            return(spans.Count);
        }
示例#2
0
        internal static async Task <byte[]> SerializeThrift(JaegerBatch batch)
        {
            var transport = new TMemoryBufferClientTransport();
            var protocol  = new TBinaryProtocol(transport);

            await batch.WriteAsync(protocol, new CancellationToken());

            return(transport.GetBuffer());
        }
示例#3
0
        protected override async Task <int> SendAsync(List <JaegerSpan> spans, CancellationToken cancellationToken)
        {
            var batch = new JaegerBatch(_process, spans);
            await batch.WriteAsync(_protocol, cancellationToken);

            await _protocol.Transport.FlushAsync(cancellationToken);

            return(spans.Count);
        }
 protected override async Task SendAsync(ThriftProcess process, List <ThriftSpan> spans, CancellationToken cancellationToken)
 {
     try
     {
         var batch = new ThriftBatch(process, spans);
         await _agentClient.emitBatchAsync(batch, cancellationToken).ConfigureAwait(false);
     }
     catch (Exception ex)
     {
         throw new SenderException($"Could not send {spans.Count} spans", ex, spans.Count);
     }
 }
示例#5
0
        public override async Task Send(List <JaegerSpan> spans)
        {
            var batch = new JaegerBatch(_process, spans);
            var body  = await SerializeThrift(batch);

            var content = new ByteArrayContent(body);

            content.Headers.ContentType = new MediaTypeHeaderValue("application/x-thrift");

            var response = await HttpClient.PostAsync(Uri, content);

            response.EnsureSuccessStatusCode();
        }
        protected override async Task SendAsync(ThriftProcess process, List <ThriftSpan> spans, CancellationToken cancellationToken)
        {
            try
            {
                var batch = new ThriftBatch(process, spans);
                await batch.WriteAsync(_protocol, cancellationToken).ConfigureAwait(false);

                await _protocol.Transport.FlushAsync(cancellationToken).ConfigureAwait(false);
            }
            catch (Exception ex)
            {
                throw new SenderException($"Could not send {spans.Count} spans", ex, spans.Count);
            }
        }
示例#7
0
            public async Task emitBatchAsync(Jaeger.Thrift.Batch batch, CancellationToken cancellationToken)
            {
                await OutputProtocol.WriteMessageBeginAsync(new TMessage("emitBatch", TMessageType.Oneway, SeqId), cancellationToken);

                var args = new emitBatchArgs();

                args.Batch = batch;

                await args.WriteAsync(OutputProtocol, cancellationToken);

                await OutputProtocol.WriteMessageEndAsync(cancellationToken);

                await OutputProtocol.Transport.FlushAsync(cancellationToken);
            }
示例#8
0
            public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken)
            {
                iprot.IncrementRecursionDepth();
                try
                {
                    TField field;
                    await iprot.ReadStructBeginAsync(cancellationToken);

                    while (true)
                    {
                        field = await iprot.ReadFieldBeginAsync(cancellationToken);

                        if (field.Type == TType.Stop)
                        {
                            break;
                        }

                        switch (field.ID)
                        {
                        case 1:
                            if (field.Type == TType.Struct)
                            {
                                Batch = new Jaeger.Thrift.Batch();
                                await Batch.ReadAsync(iprot, cancellationToken);
                            }
                            else
                            {
                                await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
                            }
                            break;

                        default:
                            await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);

                            break;
                        }

                        await iprot.ReadFieldEndAsync(cancellationToken);
                    }

                    await iprot.ReadStructEndAsync(cancellationToken);
                }
                finally
                {
                    iprot.DecrementRecursionDepth();
                }
            }