Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
80.00% |
4 / 5 |
|
80.00% |
4 / 5 |
CRAP | |
0.00% |
0 / 1 |
NoopTracer | |
80.00% |
4 / 5 |
|
80.00% |
4 / 5 |
5.20 | |
0.00% |
0 / 1 |
__construct | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
createSpan | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
createRootSpan | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
createSpanWithParent | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
shutdown | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 |
1 | <?php |
2 | namespace Wikimedia\Telemetry; |
3 | |
4 | /** |
5 | * A no-op tracer that creates no-op spans and persists no data. |
6 | * Useful for scenarios where tracing is disabled. |
7 | * |
8 | * @since 1.43 |
9 | * @internal |
10 | */ |
11 | class NoopTracer implements TracerInterface { |
12 | |
13 | private SpanContext $noopSpanContext; |
14 | |
15 | public function __construct() { |
16 | $this->noopSpanContext = new SpanContext( '', '', null, '', false ); |
17 | } |
18 | |
19 | /** @inheritDoc */ |
20 | public function createSpan( string $spanName, $parentSpan = null ): SpanInterface { |
21 | return new NoopSpan( $this->noopSpanContext ); |
22 | } |
23 | |
24 | /** @inheritDoc */ |
25 | public function createRootSpan( string $spanName ): SpanInterface { |
26 | return new NoopSpan( $this->noopSpanContext ); |
27 | } |
28 | |
29 | /** @inheritDoc */ |
30 | public function createSpanWithParent( string $spanName, SpanContext $parentSpanContext ): SpanInterface { |
31 | return new NoopSpan( $this->noopSpanContext ); |
32 | } |
33 | |
34 | /** @inheritDoc */ |
35 | public function shutdown(): void { |
36 | // no-op |
37 | } |
38 | } |