public ProbabilisticSamplingStrategy DeepCopy()
        {
            var tmp0 = new ProbabilisticSamplingStrategy();

            tmp0.SamplingRate = this.SamplingRate;
            return(tmp0);
        }
コード例 #2
0
        public void JaegerThriftProbabilisticSamplingStrategy_FromThrift()
        {
            var strat = new JaegerThriftProbabilisticSamplingStrategy(0.25);

            var from = strat.FromThrift();

            Assert.Equal(strat.SamplingRate, from.SamplingRate);
        }
コード例 #3
0
        public void JaegerThriftOperationSamplingStrategy_FromThrift()
        {
            var pss   = new JaegerThriftProbabilisticSamplingStrategy(0.75);
            var strat = new JaegerThriftOperationSamplingStrategy("opName", pss);

            var from = strat.FromThrift();

            Assert.Equal(strat.Operation, from.Operation);
            Assert.Equal(pss.SamplingRate, from.ProbabilisticSampling.SamplingRate);
        }
コード例 #4
0
        public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken)
        {
            iprot.IncrementRecursionDepth();
            try
            {
                bool   isset_strategyType = false;
                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.I32)
                        {
                            StrategyType = (SamplingStrategyType)await iprot.ReadI32Async(cancellationToken);

                            isset_strategyType = true;
                        }
                        else
                        {
                            await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
                        }
                        break;

                    case 2:
                        if (field.Type == TType.Struct)
                        {
                            ProbabilisticSampling = new ProbabilisticSamplingStrategy();
                            await ProbabilisticSampling.ReadAsync(iprot, cancellationToken);
                        }
                        else
                        {
                            await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
                        }
                        break;

                    case 3:
                        if (field.Type == TType.Struct)
                        {
                            RateLimitingSampling = new RateLimitingSamplingStrategy();
                            await RateLimitingSampling.ReadAsync(iprot, cancellationToken);
                        }
                        else
                        {
                            await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
                        }
                        break;

                    case 4:
                        if (field.Type == TType.Struct)
                        {
                            OperationSampling = new PerOperationSamplingStrategies();
                            await OperationSampling.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);

                if (!isset_strategyType)
                {
                    throw new TProtocolException(TProtocolException.INVALID_DATA);
                }
            }
            finally
            {
                iprot.DecrementRecursionDepth();
            }
        }
コード例 #5
0
 public OperationSamplingStrategy(string operation, ProbabilisticSamplingStrategy probabilisticSampling) : this()
 {
     this.Operation             = operation;
     this.ProbabilisticSampling = probabilisticSampling;
 }