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 OpenTracing;
use DateTimeInterface;
interface Span
{
/**
* @return string
*/
public function getOperationName(): string;
/**
* Yields the SpanContext for this Span. Note that the return value of
* Span::getContext() is still valid after a call to Span::finish(), as is
* a call to Span::getContext() after a call to Span::finish().
*
* @return SpanContext
*/
public function getContext(): SpanContext;
/**
* Sets the end timestamp and finalizes Span state.
*
* With the exception of calls to getContext() (which are always allowed),
* finish() must be the last call made to any span instance, and to do
* otherwise leads to undefined behavior but not returning an exception.
*
* As an implementor, make sure you call {@see Tracer::deactivate()}
* otherwise new spans might try to be child of this one.
*
* If the span is already finished, a warning should be logged.
*
* @param float|int|DateTimeInterface|null $finishTime if passing float or int
* it should represent the timestamp (including as many decimal places as you need)
* @return void
*/
public function finish($finishTime = null): void;
/**
* If the span is already finished, a warning should be logged.
*
* @param string $newOperationName
* @return void
*/
public function overwriteOperationName(string $newOperationName): void;
/**
* Adds a tag to the span.
*
* If there is a pre-existing tag set for key, it is overwritten.
*
* As an implementor, consider using "standard tags" listed in {@see \OpenTracing\Tags}
*
* If the span is already finished, a warning should be logged.
*
* @param string $key
* @param string|bool|int|float $value
* @return void
*/
public function setTag(string $key, $value): void;
/**
* Adds a log record to the span in key => value format, key must be a string and tag must be either
* a string, a boolean value, or a numeric type.
*
* If the span is already finished, a warning should be logged.
*
* @param array $fields
* @param int|float|DateTimeInterface $timestamp
* @return void
*/
public function log(array $fields = [], $timestamp = null): void;
/**
* Adds a baggage item to the SpanContext which is immutable so it is required to use
* SpanContext::withBaggageItem to get a new one.
*
* If the span is already finished, a warning should be logged.
*
* @param string $key
* @param string $value
* @return void
*/
public function addBaggageItem(string $key, string $value): void;
/**
* @param string $key
* @return string|null returns null when there is not a item under the provided key
*/
public function getBaggageItem(string $key): ?string;
}
|