• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

FriendsOfOpenTelemetry / opentelemetry-bundle / 7739220651

01 Feb 2024 09:44AM UTC coverage: 38.028% (-26.5%) from 64.527%
7739220651

Pull #38

github

gaelreyrol
wip
Pull Request #38: Refactor services injection

103 of 459 new or added lines in 44 files covered. (22.44%)

255 existing lines in 18 files now uncovered.

802 of 2109 relevant lines covered (38.03%)

8.63 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/OpenTelemetry/Trace/SamplerFactory.php
1
<?php
2

3
namespace FriendsOfOpenTelemetry\OpenTelemetryBundle\OpenTelemetry\Trace;
4

5
use OpenTelemetry\SDK\Trace\Sampler\AlwaysOffSampler;
6
use OpenTelemetry\SDK\Trace\Sampler\AlwaysOnSampler;
7
use OpenTelemetry\SDK\Trace\Sampler\ParentBased;
8
use OpenTelemetry\SDK\Trace\Sampler\TraceIdRatioBasedSampler;
9
use OpenTelemetry\SDK\Trace\SamplerInterface;
10

11
final class SamplerFactory
12
{
13
    public static function create(string $name, float $probability = null): SamplerInterface
14
    {
NEW
15
        $sampler = TraceSamplerEnum::tryFrom($name);
×
16

NEW
17
        return match ($sampler) {
×
NEW
18
            TraceSamplerEnum::AlwaysOn => new AlwaysOnSampler(),
×
NEW
19
            TraceSamplerEnum::AlwaysOff => new AlwaysOffSampler(),
×
NEW
20
            TraceSamplerEnum::ParentBasedAlwaysOn => new ParentBased(new AlwaysOnSampler()),
×
NEW
21
            TraceSamplerEnum::ParentBasedAlwaysOff => new ParentBased(new AlwaysOffSampler()),
×
NEW
22
            TraceSamplerEnum::ParentBasedTraceIdRatio => new ParentBased(new TraceIdRatioBasedSampler($probability)),
×
NEW
23
            TraceSamplerEnum::TraceIdRatio => new TraceIdRatioBasedSampler($probability),
×
NEW
24
            default => throw new \InvalidArgumentException(sprintf('Unknown sampler: %s', $name)),
×
NEW
25
        };
×
26
    }
27
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc