From c01f1de60d2d295c4dc66f0a1284a0d83bd83b58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=A3=E8=A8=80=E5=B0=B1=E6=98=AFSiam?= <59419979@qq.com> Date: Thu, 23 Nov 2023 15:56:26 +0800 Subject: [PATCH] Optimize the tracer component by replacing the direct instantiation with a closure at Context::getOrSet. (#6315) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: 李铭昕 <715557344@qq.com> --- src/TracerContext.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/TracerContext.php b/src/TracerContext.php index 8117e4c..5e2af2e 100644 --- a/src/TracerContext.php +++ b/src/TracerContext.php @@ -32,7 +32,7 @@ public static function setTracer(Tracer $tracer): Tracer public static function getTracer(): Tracer { - return Context::getOrSet(self::TRACER, make(Tracer::class)); + return Context::getOrSet(self::TRACER, fn () => make(Tracer::class)); } public static function setRoot(Span $root): Span