MediaWiki master
Wikimedia\Telemetry\NoopTracer Class Reference

A no-op tracer that creates no-op spans and persists no data. More...

Inherits Wikimedia\Telemetry\TracerInterface.

Collaboration diagram for Wikimedia\Telemetry\NoopTracer:

Public Member Functions

 __construct (?ContextPropagatorInterface $contextPropagator=null)
 
 createRootSpan (string $spanName)
 Create a new root span, i.e.a span with no parent that forms the basis for a new trace.
Parameters
string$spanNameThe descriptive name of this span. Refer to the OTEL Tracing API spec for recommended naming conventions.
Returns
SpanInterface

 
 createRootSpanFromCarrier (string $spanName, array $carrier)
 Create a span from a carrier (e.g.HTTP headers) that was extracted from a remote call. The configured implementation of ContextPropagatorInterface will be used to extract the span context. If no span context could be extracted, a new root span will be created.
Parameters
string$spanNameThe descriptive name of this span. Refer to the OTEL Tracing API spec for recommended naming conventions.
array$carrierThe carrier data extracted from the remote call.
Returns
SpanInterface

 
 createSpan (string $spanName, $parentSpan=null)
 
 createSpanWithParent (string $spanName, SpanContext $parentSpanContext)
 Create a span with the given name and parent.
Parameters
string$spanNameThe descriptive name of this span. Refer to the OTEL Tracing API spec for recommended naming conventions.
SpanContext$parentSpanContextContext of the parent span this span should be associated with.
Returns
SpanInterface

 
 getRequestHeaders ()
 Get Headers to be attached to outgoing requests.Caution: Telemetry headers should not be attached to requests bound for external/untrusted services. They are intended and designed to allow correlation of requests from clients, which can be a privacy concern. In the future, telemetry might even contain explicit user identifiers or other sensitive information.
Returns
array<string, string> Headers array

 
 shutdown ()
 Shut down this tracer and export collected trace data.
Returns
void

 
- Public Member Functions inherited from Wikimedia\Telemetry\TracerInterface
 createSpan (string $spanName)
 Create a span with the given name and the currently active span as the implicit parent.
 

Detailed Description

A no-op tracer that creates no-op spans and persists no data.

Useful for scenarios where tracing is disabled. Can still propagate some (not-Span-specific) context, like X-Request-Id.

Since
1.43
Access: internal

Definition at line 12 of file NoopTracer.php.

Constructor & Destructor Documentation

◆ __construct()

Wikimedia\Telemetry\NoopTracer::__construct ( ?ContextPropagatorInterface $contextPropagator = null)

Definition at line 18 of file NoopTracer.php.

Member Function Documentation

◆ createRootSpan()

Wikimedia\Telemetry\NoopTracer::createRootSpan ( string $spanName)

Create a new root span, i.e.a span with no parent that forms the basis for a new trace.

Parameters
string$spanNameThe descriptive name of this span. Refer to the OTEL Tracing API spec for recommended naming conventions.
Returns
SpanInterface

Implements Wikimedia\Telemetry\TracerInterface.

Definition at line 30 of file NoopTracer.php.

◆ createRootSpanFromCarrier()

Wikimedia\Telemetry\NoopTracer::createRootSpanFromCarrier ( string $spanName,
array $carrier )

Create a span from a carrier (e.g.HTTP headers) that was extracted from a remote call. The configured implementation of ContextPropagatorInterface will be used to extract the span context. If no span context could be extracted, a new root span will be created.

Parameters
string$spanNameThe descriptive name of this span. Refer to the OTEL Tracing API spec for recommended naming conventions.
array$carrierThe carrier data extracted from the remote call.
Returns
SpanInterface

Implements Wikimedia\Telemetry\TracerInterface.

Definition at line 45 of file NoopTracer.php.

◆ createSpan()

Wikimedia\Telemetry\NoopTracer::createSpan ( string $spanName,
$parentSpan = null )

Definition at line 25 of file NoopTracer.php.

◆ createSpanWithParent()

Wikimedia\Telemetry\NoopTracer::createSpanWithParent ( string $spanName,
SpanContext $parentSpanContext )

Create a span with the given name and parent.

Parameters
string$spanNameThe descriptive name of this span. Refer to the OTEL Tracing API spec for recommended naming conventions.
SpanContext$parentSpanContextContext of the parent span this span should be associated with.
Returns
SpanInterface

Implements Wikimedia\Telemetry\TracerInterface.

Definition at line 35 of file NoopTracer.php.

◆ getRequestHeaders()

Wikimedia\Telemetry\NoopTracer::getRequestHeaders ( )

Get Headers to be attached to outgoing requests.Caution: Telemetry headers should not be attached to requests bound for external/untrusted services. They are intended and designed to allow correlation of requests from clients, which can be a privacy concern. In the future, telemetry might even contain explicit user identifiers or other sensitive information.

Returns
array<string, string> Headers array

Implements Wikimedia\Http\TelemetryHeadersInterface.

Definition at line 50 of file NoopTracer.php.

◆ shutdown()

Wikimedia\Telemetry\NoopTracer::shutdown ( )

Shut down this tracer and export collected trace data.

Returns
void

Implements Wikimedia\Telemetry\TracerInterface.

Definition at line 40 of file NoopTracer.php.


The documentation for this class was generated from the following file: