MediaWiki master
SpanInterface.php
Go to the documentation of this file.
1<?php
2namespace Wikimedia\Telemetry;
3
14interface SpanInterface {
19 public const SPAN_KIND_INTERNAL = 1;
20
25 public const SPAN_KIND_SERVER = 2;
26
30 public const SPAN_KIND_CLIENT = 3;
31
35 public const SPAN_KIND_PRODUCER = 4;
36
41 public const SPAN_KIND_CONSUMER = 5;
42
51 public function setSpanKind( int $spanKind ): SpanInterface;
52
57 public const SPAN_STATUS_UNSET = 0;
58
62 public const SPAN_STATUS_OK = 1;
63
68 public const SPAN_STATUS_ERROR = 2;
69
76 public function setSpanStatus( int $spanStatus ): SpanInterface;
77
92 public function setAttributes( array $attributes ): SpanInterface;
93
100 public function start( ?int $epochNanos = null ): SpanInterface;
101
111 public function end( ?int $epochNanos = null ): void;
112
129 public function activate(): SpanInterface;
130
138 public function deactivate(): SpanInterface;
139
144 public function getContext(): SpanContext;
145}
Data transfer object holding data associated with a given span.
Represents an OpenTelemetry span, i.e.
start(?int $epochNanos=null)
Start this span, optionally specifying an override for its start time.
setSpanKind(int $spanKind)
Set the kind of this span, which describes how it relates to its parent and children within the overa...
const SPAN_KIND_PRODUCER
Indicates that the span describes the initiators of an asynchronous request.
const SPAN_KIND_CLIENT
Indicates that the span describes a request to some remote service.
deactivate()
Deactivate this span.
getContext()
Get the context holding data for this span.
setSpanStatus(int $spanStatus)
Set the status of this span.
activate()
Make this span the active span.
const SPAN_STATUS_ERROR
Indicates that the operation represented by this span failed.
const SPAN_KIND_INTERNAL
Default value.
const SPAN_KIND_CONSUMER
Indicates that the span describes a child of an asynchronous SpanInterface::SPAN_KIND_PRODUCER reques...
const SPAN_KIND_SERVER
Indicates that the span covers server-side handling of a synchronous RPC or other incoming request fr...
const SPAN_STATUS_UNSET
Default value.
const SPAN_STATUS_OK
Indicates that the operation represented by this span was successful.
setAttributes(array $attributes)
Set attributes (arbitrary metadata) for this span.
end(?int $epochNanos=null)
End this span, optionally specifying an override for its end time.