From 1f1a1d4f3b0a221cc6c23498e461258cf86093e3 Mon Sep 17 00:00:00 2001 From: prondubuisi Date: Sat, 19 Sep 2020 05:07:25 +0100 Subject: [PATCH] change instances of probabilitysampler to traceidratiobasedsampler force push for CLA fixes #174 --- sdk/Trace/Sampler.php | 2 +- ...ySampler.php => TraceIdRatioBasedSampler.php} | 10 +++++----- ...Test.php => TraceIdRatioBasedSamplerTest.php} | 16 ++++++++-------- 3 files changed, 14 insertions(+), 14 deletions(-) rename sdk/Trace/Sampler/{ProbabilitySampler.php => TraceIdRatioBasedSampler.php} (84%) rename tests/Sdk/Integration/{ProbabilitySamplerTest.php => TraceIdRatioBasedSamplerTest.php} (64%) diff --git a/sdk/Trace/Sampler.php b/sdk/Trace/Sampler.php index 5307c05b1..cb00afda3 100644 --- a/sdk/Trace/Sampler.php +++ b/sdk/Trace/Sampler.php @@ -41,7 +41,7 @@ public function shouldSample( /** * Returns the sampler name or short description with the configuration. * This may be displayed on debug pages or in the logs. - * Example: "ProbabilitySampler{0.000100}" + * Example: "TraceIdRatioBasedSampler{0.000100}" * @return string */ public function getDescription(): string; diff --git a/sdk/Trace/Sampler/ProbabilitySampler.php b/sdk/Trace/Sampler/TraceIdRatioBasedSampler.php similarity index 84% rename from sdk/Trace/Sampler/ProbabilitySampler.php rename to sdk/Trace/Sampler/TraceIdRatioBasedSampler.php index 915f3647a..5820f9d89 100644 --- a/sdk/Trace/Sampler/ProbabilitySampler.php +++ b/sdk/Trace/Sampler/TraceIdRatioBasedSampler.php @@ -12,11 +12,11 @@ * This implementation of the SamplerInterface records with given probability. * Example: * ``` - * use OpenTelemetry\Trace\ProbabilitySampler; - * $sampler = new ProbabilitySampler(0.01); + * use OpenTelemetry\Trace\TraceIdRatioBasedSampler; + * $sampler = new TraceIdRatioBasedSampler(0.01); * ``` */ -class ProbabilitySampler implements Sampler +class TraceIdRatioBasedSampler implements Sampler { /** * @var float @@ -24,7 +24,7 @@ class ProbabilitySampler implements Sampler private $probability; /** - * ProbabilitySampler constructor. + * TraceIdRatioBasedSampler constructor. * @param float $probability Probability float value between 0.0 and 1.0. */ public function __construct(float $probability) @@ -59,6 +59,6 @@ public function shouldSample( public function getDescription(): string { - return sprintf('%s{%.6f}', 'ProbabilitySampler', $this->probability); + return sprintf('%s{%.6f}', 'TraceIdRatioBasedSampler', $this->probability); } } diff --git a/tests/Sdk/Integration/ProbabilitySamplerTest.php b/tests/Sdk/Integration/TraceIdRatioBasedSamplerTest.php similarity index 64% rename from tests/Sdk/Integration/ProbabilitySamplerTest.php rename to tests/Sdk/Integration/TraceIdRatioBasedSamplerTest.php index ba7848577..51ce94970 100644 --- a/tests/Sdk/Integration/ProbabilitySamplerTest.php +++ b/tests/Sdk/Integration/TraceIdRatioBasedSamplerTest.php @@ -4,16 +4,16 @@ namespace OpenTelemetry\Tests\Sdk\Integration; -use OpenTelemetry\Sdk\Trace\Sampler\ProbabilitySampler; +use OpenTelemetry\Sdk\Trace\Sampler\TraceIdRatioBasedSampler; use OpenTelemetry\Sdk\Trace\SamplingResult; use OpenTelemetry\Trace as API; use PHPUnit\Framework\TestCase; -class ProbabilitySamplerTest extends TestCase +class TraceIdRatioBasedSamplerTest extends TestCase { - public function testNeverProbabilitySamplerDecision() + public function testNeverTraceIdRatioBasedSamplerDecision() { - $sampler = new ProbabilitySampler(0.0); + $sampler = new TraceIdRatioBasedSampler(0.0); $decision = $sampler->shouldSample( null, '4bf92f3577b34da6a3ce929d0e0e4736', @@ -24,9 +24,9 @@ public function testNeverProbabilitySamplerDecision() $this->assertEquals(SamplingResult::NOT_RECORD, $decision->getDecision()); } - public function testAlwaysProbabilitySamplerDecision() + public function testAlwaysTraceIdRatioBasedSamplerDecision() { - $sampler = new ProbabilitySampler(1.0); + $sampler = new TraceIdRatioBasedSampler(1.0); $decision = $sampler->shouldSample( null, '4bf92f3577b34da6a3ce929d0e0e4736', @@ -39,7 +39,7 @@ public function testAlwaysProbabilitySamplerDecision() public function testAlwaysOnSamplerDescription() { - $sampler = new ProbabilitySampler(0.0001); - $this->assertEquals('ProbabilitySampler{0.000100}', $sampler->getDescription()); + $sampler = new TraceIdRatioBasedSampler(0.0001); + $this->assertEquals('TraceIdRatioBasedSampler{0.000100}', $sampler->getDescription()); } }