Skip to content

Commit e8229ac

Browse files
authored
Flag for backend
1 parent 61b7dba commit e8229ac

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

src/Tracer.php

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,21 +75,25 @@ public function addSpan($span)
7575

7676
/**
7777
* Save trace
78+
*
79+
* @param $unsetParentId bool are you frontend?
7880
*/
79-
public function trace()
81+
public function trace($unsetParentId = true)
8082
{
8183
if (!TracerInfo::isSampled()) {
8284
return;
8385
}
8486

85-
$this->addTraceSpan();
87+
$this->addTraceSpan($unsetParentId);
8688
$this->logger->trace($this->spans);
8789
}
8890

8991
/**
9092
* Adds main span to Spans
93+
*
94+
* @param $unsetParentId bool are you frontend?
9195
*/
92-
protected function addTraceSpan()
96+
protected function addTraceSpan($unsetParentId = true)
9397
{
9498
$span = new Span(
9599
TracerInfo::getTraceSpanId(),
@@ -101,7 +105,9 @@ protected function addTraceSpan()
101105
AnnotationBlock::SERVER
102106
)
103107
);
104-
$span->unsetParentId();
108+
if ($unsetParentId) {
109+
$span->unsetParentId();
110+
}
105111
$this->addSpan($span);
106112
}
107113

0 commit comments

Comments
 (0)