Skip to content

Commit

Permalink
Support swow psr7-plus interface for all components. (#5839)
Browse files Browse the repository at this point in the history
  • Loading branch information
limingxinleo committed Jun 16, 2023
1 parent 0080447 commit 33ad049
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/SpanStarter.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

use Hyperf\Context\ApplicationContext;
use Hyperf\Context\Context;
use Hyperf\Context\RequestContext;
use Hyperf\Rpc;
use OpenTracing\Span;
use Psr\Http\Message\ServerRequestInterface;
Expand All @@ -34,8 +35,7 @@ protected function startSpan(
$root = Context::get('tracer.root');
if (! $root instanceof Span) {
$container = ApplicationContext::getContainer();
/** @var ServerRequestInterface $request */
$request = Context::get(ServerRequestInterface::class);
$request = RequestContext::getOrNull();
if (! $request instanceof ServerRequestInterface) {
// If the request object is absent, we are probably in a commandline context.
// Throwing an exception is unnecessary.
Expand Down

0 comments on commit 33ad049

Please sign in to comment.