Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change instances of alwaysparentsampler to parentorelse #180

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
* This implementation of the SamplerInterface always records.
* Example:
* ```
* use OpenTelemetry\Trace\AlwaysParentSampler;
* $sampler = new AlwaysParentSampler();
* use OpenTelemetry\Trace\ParentBased;
* $sampler = new ParentBased();
* ```
*/
class AlwaysParentSampler implements Sampler
class ParentBased implements Sampler
{
/**
* Returns `RECORD_AND_SAMPLED` if SampledFlag is set to true on parent SpanContext and `NOT_RECORD` otherwise.
Expand All @@ -40,6 +40,6 @@ public function shouldSample(

public function getDescription(): string
{
return 'AlwaysParentSampler';
return 'ParentBased';
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,22 @@

namespace OpenTelemetry\Tests\Sdk\Integration;

use OpenTelemetry\Sdk\Trace\Sampler\AlwaysParentSampler;
use OpenTelemetry\Sdk\Trace\Sampler\ParentBased;
use OpenTelemetry\Sdk\Trace\SamplingResult;
use OpenTelemetry\Sdk\Trace\SpanContext;
use OpenTelemetry\Trace as API;
use PHPUnit\Framework\TestCase;

class AlwaysParentSamplerTest extends TestCase
class ParentBasedTest extends TestCase
{
public function testRecordAlwaysParentSamplerDecision()
public function testRecordParentBasedDecision()
{
$parentContext = new SpanContext(
'4bf92f3577b34da6a3ce929d0e0e4736',
'00f067aa0ba902b7',
0x1
);
$sampler = new AlwaysParentSampler();
$sampler = new ParentBased();
$decision = $sampler->shouldSample(
$parentContext,
'4bf92f3577b34da6a3ce929d0e0e4736',
Expand All @@ -30,14 +30,14 @@ public function testRecordAlwaysParentSamplerDecision()
$this->assertEquals(SamplingResult::RECORD_AND_SAMPLED, $decision->getDecision());
}

public function testSkipAlwaysParentSamplerDecision()
public function testSkipParentBasedDecision()
{
$parentContext = new SpanContext(
'4bf92f3577b34da6a3ce929d0e0e4736',
'00f067aa0ba902b7',
0
);
$sampler = new AlwaysParentSampler();
$sampler = new ParentBased();
$decision = $sampler->shouldSample(
$parentContext,
'4bf92f3577b34da6a3ce929d0e0e4736',
Expand All @@ -48,9 +48,9 @@ public function testSkipAlwaysParentSamplerDecision()
$this->assertEquals(SamplingResult::NOT_RECORD, $decision->getDecision());
}

public function testNullAlwaysParentSamplerDecision()
public function testNullParentBasedDecision()
{
$sampler = new AlwaysParentSampler();
$sampler = new ParentBased();
$decision = $sampler->shouldSample(
null,
'4bf92f3577b34da6a3ce929d0e0e4736',
Expand All @@ -61,9 +61,9 @@ public function testNullAlwaysParentSamplerDecision()
$this->assertEquals(SamplingResult::NOT_RECORD, $decision->getDecision());
}

public function testAlwaysParentSamplerDescription()
public function testParentBasedDescription()
{
$sampler = new AlwaysParentSampler();
$this->assertEquals('AlwaysParentSampler', $sampler->getDescription());
$sampler = new ParentBased();
$this->assertEquals('ParentBased', $sampler->getDescription());
}
}