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

FriendsOfOpenTelemetry / opentelemetry-bundle / 7738304608

01 Feb 2024 08:26AM UTC coverage: 37.885% (-26.6%) from 64.527%
7738304608

Pull #38

github

gaelreyrol
wip
Pull Request #38: Refactor services injection

100 of 459 new or added lines in 44 files covered. (21.79%)

255 existing lines in 18 files now uncovered.

799 of 2109 relevant lines covered (37.89%)

8.53 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