MediaWiki master
Wikimedia\Telemetry\Tracer Class Reference

Inherits Wikimedia\Telemetry\TracerInterface.

Collaboration diagram for Wikimedia\Telemetry\Tracer:

Public Member Functions

 __construct (Clock $clock, SamplerInterface $sampler, ExporterInterface $exporter, TracerState $tracerState, ContextPropagatorInterface $contextPropagator)
 
 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)
 Create a span with the given name and the currently active span as the implicit parent.This requires a span to be already active and will throw an error otherwise.
Parameters
string$spanNameThe descriptive name of this span. Refer to the OTEL Tracing API spec for recommended naming conventions.
Returns
SpanInterface
Exceptions
PreconditionExceptionIf no span was active

 
 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

 

Detailed Description

Since
1.43
Access: internal

Definition at line 10 of file Tracer.php.

Constructor & Destructor Documentation

◆ __construct()

Wikimedia\Telemetry\Tracer::__construct ( Clock $clock,
SamplerInterface $sampler,
ExporterInterface $exporter,
TracerState $tracerState,
ContextPropagatorInterface $contextPropagator )

Definition at line 33 of file Tracer.php.

Member Function Documentation

◆ createRootSpan()

Wikimedia\Telemetry\Tracer::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 64 of file Tracer.php.

◆ createRootSpanFromCarrier()

Wikimedia\Telemetry\Tracer::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 74 of file Tracer.php.

◆ createSpan()

Wikimedia\Telemetry\Tracer::createSpan ( string $spanName)

Create a span with the given name and the currently active span as the implicit parent.This requires a span to be already active and will throw an error otherwise.

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

Implements Wikimedia\Telemetry\TracerInterface.

Definition at line 48 of file Tracer.php.

◆ createSpanWithParent()

Wikimedia\Telemetry\Tracer::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 69 of file Tracer.php.

◆ getRequestHeaders()

Wikimedia\Telemetry\Tracer::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 80 of file Tracer.php.

◆ shutdown()

Wikimedia\Telemetry\Tracer::shutdown ( )

Shut down this tracer and export collected trace data.

Returns
void

Implements Wikimedia\Telemetry\TracerInterface.

Definition at line 111 of file Tracer.php.


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