We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent bb07aca commit 01c46a2Copy full SHA for 01c46a2
src/SDK/Resource/ResourceInfoFactory.php
@@ -17,6 +17,8 @@ class ResourceInfoFactory
17
{
18
use LogsMessagesTrait;
19
20
+ private static ?ResourceInfo $emptyResource = null;
21
+
22
public static function defaultResource(): ResourceInfo
23
24
$detectors = Configuration::getList(Env::OTEL_PHP_DETECTORS);
@@ -90,6 +92,10 @@ public static function defaultResource(): ResourceInfo
90
92
91
93
public static function emptyResource(): ResourceInfo
94
- return ResourceInfo::create(Attributes::create([]));
95
+ if (null === self::$emptyResource) {
96
+ self::$emptyResource = ResourceInfo::create(Attributes::create([]));
97
+ }
98
99
+ return self::$emptyResource;
100
}
101
0 commit comments