Skip to content

Commit

Permalink
fix: 修改span finish 异常记录
Browse files Browse the repository at this point in the history
  • Loading branch information
titrxw committed Jul 13, 2021
1 parent 1433c52 commit e25a7c5
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/TracerSpanTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,15 @@ protected function getSpan(string $spanName = 'server', string $kind = 'server',
protected function finishSpan(Span $span) {
$contextKey = 'opentracing.tracer.span.' . $span->getOperationName() . '.' . $span->getContext()->getBaggageItem('x-span-kind') . '.' . $span->getContext()->getBaggageItem('x-span-tracer');
$this->getContext()->setContextDataByKey($contextKey, null);
$span->finish();
try {
$span->finish();
} catch (\Throwable $e) {
/**
* @var HandlerExceptions $exceptionHandler
*/
$exceptionHandler = $this->getContainer()->get(HandlerExceptions::class);
$exceptionHandler->getHandler()->report($e);
}
}

protected function makeSpan($traceName, $spanName, $kind) {
Expand Down

0 comments on commit e25a7c5

Please sign in to comment.