-
Notifications
You must be signed in to change notification settings - Fork 191
/
Span.php
95 lines (78 loc) · 3.1 KB
/
Span.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
<?php
declare(strict_types=1);
namespace OpenTelemetry\Trace;
use Exception;
interface Span extends SpanStatus, SpanKind
{
public function getSpanName(): string;
public function getContext(): SpanContext;
public function getParent(): ?SpanContext;
/**
* Returns Epoch timestamp value (RealtimeClock) when the Span was created
* @return int
*/
public function getStartEpochTimestamp(): int;
/**
* Returns system time clock value (MonotonicClock) when the Span was created
* @return int
*/
public function getStart(): int;
/**
* Returns system time clock value (MonotonicClock) when the Span was stopped
* @return int|null
*/
public function getEnd(): ?int;
public function getAttributes(): Attributes;
public function getLinks(): Links;
public function getEvents(): Events;
public function getStatus(): SpanStatus;
/**
* Attributes SHOULD preserve the order in which they're set. Setting an attribute with the same key as an existing
* attribute SHOULD overwrite the existing attribute's value.
* @param string $key
* @param bool|int|float|string|array $value Note: the array MUST be homogeneous, i.e. it MUST NOT contain values
* of different types.
* @return Span Must return $this to allow setting multiple attributes at once in a chain
*/
public function setAttribute(string $key, $value): Span;
/**
* @param string $name
* @param int $timestamp
* @param Attributes|null $attributes
* @return Span Must return $this to allow setting multiple attributes at once in a chain.
*/
public function addEvent(string $name, int $timestamp, ?Attributes $attributes = null): Span;
/**
* @param SpanContext $context
* @param Attributes|null $attributes
* @return Span Must return $this to allow setting multiple links at once in a chain.
*/
public function addLink(SpanContext $context, ?Attributes $attributes = null): Span;
/**
*
* @param Exception $exception
* @return Span Must return $this to allow setting multiple attributes at once in a chain.
*/
public function recordException(Exception $exception): Span;
/**
* Calling this method is highly discouraged; the name should be set on creation and left alone.
* @param string $name
* @return Span Must return $this
*/
public function updateName(string $name): Span;
/**
* Sets the Status of the Span. If used, this will override the default Span status, which is OK.
* Only the value of the last call will be recorded, and implementations are free to ignore previous calls.
* @param string $code
* @param string|null $description
* @return Span Must return $this
*/
public function setSpanStatus(string $code, ?string $description = null): Span;
/**
* @param int|null $timestamp
* @return Span Must return $this
*/
public function end(int $timestamp = null): Span;
public function isRecording(): bool;
public function isSampled(): bool;
}