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

FriendsOfOpenTelemetry / opentelemetry-bundle / 7738721920

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

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/DependencyInjection/Compiler/HttpClientTracingPass.php
1
<?php
2

3
namespace FriendsOfOpenTelemetry\OpenTelemetryBundle\DependencyInjection\Compiler;
4

5
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
6
use Symfony\Component\DependencyInjection\ContainerBuilder;
7
use Symfony\Component\DependencyInjection\Reference;
8

9
class HttpClientTracingPass implements CompilerPassInterface
10
{
11
    public function process(ContainerBuilder $container): void
12
    {
UNCOV
13
        $decoratedService = $this->getDecoratedService($container);
×
UNCOV
14
        if (null === $decoratedService) {
×
UNCOV
15
            $container->removeDefinition('open_telemetry.instrumentation.http_client.trace.client');
×
16

UNCOV
17
            return;
×
18
        }
19

20
        if (true === $container->getParameter('open_telemetry.instrumentation.http_client.tracing.enabled')) {
×
21
            $container->getDefinition('open_telemetry.instrumentation.http_client.trace.client')
×
22
                ->setArgument('$client', new Reference('.inner'))
×
23
                ->setDecoratedService($decoratedService[0], null, $decoratedService[1]);
×
24
        } else {
25
            $container->removeDefinition('open_telemetry.instrumentation.http_client.trace.client');
×
26
        }
27

28
        if (true === $container->getParameter('open_telemetry.instrumentation.http_client.metering.enabled')) {
×
29
        }
30
    }
31

32
    /**
33
     * @return array{string, int}|null
34
     */
35
    private function getDecoratedService(ContainerBuilder $container): ?array
36
    {
UNCOV
37
        if ($container->hasDefinition('http_client.transport')) {
×
38
            return ['http_client.transport', -15];
×
39
        }
40

UNCOV
41
        if ($container->hasDefinition('http_client')) {
×
42
            return ['http_client', 15];
×
43
        }
44

UNCOV
45
        return null;
×
46
    }
47
}
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