MediaWiki master
Wikimedia\Telemetry\TracerInterface Interface Reference

Base interface for an OpenTelemetry tracer responsible for creating spans. More...

Inherits Wikimedia\Http\TelemetryHeadersInterface.

Inherited by Wikimedia\Telemetry\NoopTracer, and Wikimedia\Telemetry\Tracer.

Collaboration diagram for Wikimedia\Telemetry\TracerInterface:

Public Member Functions

 createRootSpan (string $spanName)
 Create a new root span, i.e.
 
 createRootSpanFromCarrier (string $spanName, array $carrier)
 Create a span from a carrier (e.g.
 
 createSpan (string $spanName)
 Create a span with the given name and the currently active span as the implicit parent.
 
 createSpanWithParent (string $spanName, SpanContext $parentSpanContext)
 Create a span with the given name and parent.
 
 shutdown ()
 Shut down this tracer and export collected trace data.
 
- Public Member Functions inherited from Wikimedia\Http\TelemetryHeadersInterface
 getRequestHeaders ()
 Get Headers to be attached to outgoing requests.
 

Detailed Description

Base interface for an OpenTelemetry tracer responsible for creating spans.

Since
1.43

Definition at line 11 of file TracerInterface.php.

Member Function Documentation

◆ createRootSpan()

Wikimedia\Telemetry\TracerInterface::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

Implemented in Wikimedia\Telemetry\NoopTracer, and Wikimedia\Telemetry\Tracer.

◆ createRootSpanFromCarrier()

Wikimedia\Telemetry\TracerInterface::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

Implemented in Wikimedia\Telemetry\NoopTracer, and Wikimedia\Telemetry\Tracer.

◆ createSpan()

Wikimedia\Telemetry\TracerInterface::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

Implemented in Wikimedia\Telemetry\Tracer.

◆ createSpanWithParent()

Wikimedia\Telemetry\TracerInterface::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

Implemented in Wikimedia\Telemetry\NoopTracer, and Wikimedia\Telemetry\Tracer.

◆ shutdown()

Wikimedia\Telemetry\TracerInterface::shutdown ( )

Shut down this tracer and export collected trace data.

Returns
void

Implemented in Wikimedia\Telemetry\NoopTracer, and Wikimedia\Telemetry\Tracer.


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