File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1212
1313class SpanFactory implements SpanFactoryInterface
1414{
15- private $ idGenerator ;
15+ private IdGeneratorInterface $ idGenerator ;
1616
17- private $ sampler ;
17+ private SamplerInterface $ sampler ;
1818
19- public function __construct (IdGeneratorInterface $ idGenerator , SamplerInterface $ sampler )
19+ private bool $ trace128 ;
20+
21+ public function __construct (IdGeneratorInterface $ idGenerator , SamplerInterface $ sampler , bool $ trace128 = false )
2022 {
2123 $ this ->idGenerator = $ idGenerator ;
2224 $ this ->sampler = $ sampler ;
25+ $ this ->trace128 = $ trace128 ;
2326 }
2427
2528 public function parent (
2629 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 = []
3134 ): SpanInterface {
3235 $ spanId = $ this ->idGenerator ->next ();
3336 $ traceId = $ spanId ;
@@ -36,8 +39,9 @@ public function parent(
3639 return new Span (
3740 $ tracer ,
3841 new SpanContext (
39- (int )$ traceId ,
40- (int )$ spanId ,
42+ $ this ->trace128 ? $ this ->idGenerator ->next () : 0 ,
43+ $ this ->idGenerator ->next (),
44+ $ this ->idGenerator ->next (),
4145 0 ,
4246 (int )$ samplerResult ->getFlags ()
4347 ),
@@ -50,10 +54,10 @@ public function parent(
5054
5155 public function child (
5256 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 = []
5761 ): SpanInterface {
5862 return new Span (
5963 $ tracer ,
You can’t perform that action at this time.
0 commit comments