Repository navigation
Expand file tree
/
Copy pathInstrumentation.php
More file actions
44 lines (38 loc) · 1.6 KB
/
Copy pathInstrumentation.php
File metadata and controls
44 lines (38 loc) · 1.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<?php
declare(strict_types=1);
namespace OpenTelemetry\Config\SDK;
use OpenTelemetry\API\Configuration\Context;
use OpenTelemetry\API\Instrumentation\AutoInstrumentation\ConfigurationRegistry;
use OpenTelemetry\Config\SDK\Configuration\Environment\EnvReader;
/**
* @deprecated Use {@see Configuration::parseFile()} and
* {@see Configuration::getInstrumentationConfig()} instead. Instrumentation
* configuration is a node of the same document as the SDK configuration
* ({@see https://github.com/open-telemetry/opentelemetry-configuration/pull/91}), so one
* {@see Configuration} serves both roots. Parsing them separately reads the file twice
* when the SDK root comes from the on-disk cache.
*
* @todo Remove before 1.0 of `open-telemetry/sdk-configuration`. It stays for now so instrumentations
* still on this entry point can move. The package is 0.x, so this is a courtesy rather than a
* compatibility guarantee.
*/
final class Instrumentation
{
private function __construct(
private readonly Configuration $configuration,
) {
}
public function create(Context $context = new Context()): ConfigurationRegistry
{
/** @var ConfigurationRegistry */
return $this->configuration->getInstrumentationConfig($context);
}
public static function parseFile(
string $file,
?string $cacheFile = null,
bool $debug = true,
?EnvReader $envReader = null,
): Instrumentation {
return new self(Configuration::parseFile($file, $cacheFile, $debug, $envReader));
}
}