File tree Expand file tree Collapse file tree 1 file changed +17
-13
lines changed Expand file tree Collapse file tree 1 file changed +17
-13
lines changed Original file line number Diff line number Diff line change 12
12
13
13
class SpanFactory implements SpanFactoryInterface
14
14
{
15
- private $ idGenerator ;
15
+ private IdGeneratorInterface $ idGenerator ;
16
16
17
- private $ sampler ;
17
+ private SamplerInterface $ sampler ;
18
18
19
- public function __construct (IdGeneratorInterface $ idGenerator , SamplerInterface $ sampler )
19
+ private bool $ trace128 ;
20
+
21
+ public function __construct (IdGeneratorInterface $ idGenerator , SamplerInterface $ sampler , bool $ trace128 = false )
20
22
{
21
23
$ this ->idGenerator = $ idGenerator ;
22
24
$ this ->sampler = $ sampler ;
25
+ $ this ->trace128 = $ trace128 ;
23
26
}
24
27
25
28
public function parent (
26
29
TracerInterface $ tracer ,
27
- string $ operationName ,
28
- string $ debugId ,
29
- array $ tags = [],
30
- array $ logs = []
30
+ string $ operationName ,
31
+ string $ debugId ,
32
+ array $ tags = [],
33
+ array $ logs = []
31
34
): SpanInterface {
32
35
$ spanId = $ this ->idGenerator ->next ();
33
36
$ traceId = $ spanId ;
@@ -36,8 +39,9 @@ public function parent(
36
39
return new Span (
37
40
$ tracer ,
38
41
new SpanContext (
39
- (int )$ traceId ,
40
- (int )$ spanId ,
42
+ $ this ->trace128 ? $ this ->idGenerator ->next () : 0 ,
43
+ $ this ->idGenerator ->next (),
44
+ $ this ->idGenerator ->next (),
41
45
0 ,
42
46
(int )$ samplerResult ->getFlags ()
43
47
),
@@ -50,10 +54,10 @@ public function parent(
50
54
51
55
public function child (
52
56
TracerInterface $ tracer ,
53
- string $ operationName ,
54
- SpanContext $ parentContext ,
55
- array $ tags = [],
56
- array $ logs = []
57
+ string $ operationName ,
58
+ SpanContext $ parentContext ,
59
+ array $ tags = [],
60
+ array $ logs = []
57
61
): SpanInterface {
58
62
return new Span (
59
63
$ tracer ,
You can’t perform that action at this time.
0 commit comments