Debian Codegraph @

includes/libs/telemetry/NoopTracer.php

raw symbols SCIP
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 }