summaryrefslogtreecommitdiff
path: root/vendor/open-telemetry/sdk/Common/Instrumentation/InstrumentationScopeFactory.php
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/open-telemetry/sdk/Common/Instrumentation/InstrumentationScopeFactory.php')
-rw-r--r--vendor/open-telemetry/sdk/Common/Instrumentation/InstrumentationScopeFactory.php31
1 files changed, 31 insertions, 0 deletions
diff --git a/vendor/open-telemetry/sdk/Common/Instrumentation/InstrumentationScopeFactory.php b/vendor/open-telemetry/sdk/Common/Instrumentation/InstrumentationScopeFactory.php
new file mode 100644
index 000000000..f1ae7c072
--- /dev/null
+++ b/vendor/open-telemetry/sdk/Common/Instrumentation/InstrumentationScopeFactory.php
@@ -0,0 +1,31 @@
+<?php
+
+declare(strict_types=1);
+
+namespace OpenTelemetry\SDK\Common\Instrumentation;
+
+use OpenTelemetry\SDK\Common\Attribute\AttributesFactoryInterface;
+
+final class InstrumentationScopeFactory implements InstrumentationScopeFactoryInterface
+{
+ private AttributesFactoryInterface $attributesFactory;
+
+ public function __construct(AttributesFactoryInterface $attributesFactory)
+ {
+ $this->attributesFactory = $attributesFactory;
+ }
+
+ public function create(
+ string $name,
+ ?string $version = null,
+ ?string $schemaUrl = null,
+ iterable $attributes = []
+ ): InstrumentationScopeInterface {
+ return new InstrumentationScope(
+ $name,
+ $version,
+ $schemaUrl,
+ $this->attributesFactory->builder($attributes)->build(),
+ );
+ }
+}