Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 12 |
|
0.00% |
0 / 9 |
CRAP | |
0.00% |
0 / 1 |
| NoopSpan | |
0.00% |
0 / 12 |
|
0.00% |
0 / 9 |
90 | |
0.00% |
0 / 1 |
| __construct | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 | |||
| getContext | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| setAttributes | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| setSpanKind | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| setSpanStatus | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| start | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| end | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| activate | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 | |||
| deactivate | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | namespace Wikimedia\Telemetry; |
| 3 | |
| 4 | /** |
| 5 | * An unsampled span that does nothing and persists no data. |
| 6 | * |
| 7 | * @since 1.43 |
| 8 | * @internal |
| 9 | */ |
| 10 | class NoopSpan implements SpanInterface { |
| 11 | private SpanContext $context; |
| 12 | private TracerState $tracerState; |
| 13 | |
| 14 | public function __construct( |
| 15 | TracerState $tracerState, |
| 16 | SpanContext $context |
| 17 | ) { |
| 18 | $this->tracerState = $tracerState; |
| 19 | $this->context = $context; |
| 20 | } |
| 21 | |
| 22 | /** @inheritDoc */ |
| 23 | public function getContext(): SpanContext { |
| 24 | return $this->context; |
| 25 | } |
| 26 | |
| 27 | /** @inheritDoc */ |
| 28 | public function setAttributes( array $attributes ): SpanInterface { |
| 29 | return $this; |
| 30 | } |
| 31 | |
| 32 | /** @inheritDoc */ |
| 33 | public function setSpanKind( int $spanKind ): SpanInterface { |
| 34 | return $this; |
| 35 | } |
| 36 | |
| 37 | /** @inheritDoc */ |
| 38 | public function setSpanStatus( int $status ): SpanInterface { |
| 39 | return $this; |
| 40 | } |
| 41 | |
| 42 | /** @inheritDoc */ |
| 43 | public function start( ?int $epochNanos = null ): SpanInterface { |
| 44 | return $this; |
| 45 | } |
| 46 | |
| 47 | /** @inheritDoc */ |
| 48 | public function end( ?int $epochNanos = null ): void { |
| 49 | // no-op |
| 50 | } |
| 51 | |
| 52 | /** @inheritDoc */ |
| 53 | public function activate(): SpanInterface { |
| 54 | $this->tracerState->activateSpan( $this->context ); |
| 55 | return $this; |
| 56 | } |
| 57 | |
| 58 | /** @inheritDoc */ |
| 59 | public function deactivate(): SpanInterface { |
| 60 | $this->tracerState->deactivateSpan( $this->context ); |
| 61 | return $this; |
| 62 | } |
| 63 | } |