<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: opentelemetry/proto/trace/v1/trace_config.proto

namespace Opentelemetry\Proto\Trace\V1;

use Google\Protobuf\Internal\GPBType;
use Google\Protobuf\Internal\RepeatedField;
use Google\Protobuf\Internal\GPBUtil;

/**
 * Sampler that tries to uniformly sample traces with a given ratio.
 * The ratio of sampling a trace is equal to that of the specified ratio.
 *
 * Generated from protobuf message <code>opentelemetry.proto.trace.v1.TraceIdRatioBased</code>
 */
class TraceIdRatioBased extends \Google\Protobuf\Internal\Message
{
    /**
     * The desired ratio of sampling. Must be within [0.0, 1.0].
     *
     * Generated from protobuf field <code>double samplingRatio = 1;</code>
     */
    protected $samplingRatio = 0.0;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type float $samplingRatio
     *           The desired ratio of sampling. Must be within [0.0, 1.0].
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Opentelemetry\Proto\Trace\V1\TraceConfig::initOnce();
        parent::__construct($data);
    }

    /**
     * The desired ratio of sampling. Must be within [0.0, 1.0].
     *
     * Generated from protobuf field <code>double samplingRatio = 1;</code>
     * @return float
     */
    public function getSamplingRatio()
    {
        return $this->samplingRatio;
    }

    /**
     * The desired ratio of sampling. Must be within [0.0, 1.0].
     *
     * Generated from protobuf field <code>double samplingRatio = 1;</code>
     * @param float $var
     * @return $this
     */
    public function setSamplingRatio($var)
    {
        GPBUtil::checkDouble($var);
        $this->samplingRatio = $var;

        return $this;
    }

}

