Repository: open-telemetry/opentelemetry-php (php)

Issue:
remove BC hacks before release candidates
Prior to stamping RCs, we should remove all existing backwards-compatibility hacks from `SDK/Common/Dev/BC`
remove deprecated classes and functions before release candidates
we have some deprecated code, which we've left in place to not break people's code. remove them all before we release the first release candidate.

Pull request:
remove deprecated code and BC hacks
in preparation for RC, removing deprecations and BC hacks so that we have a clean slate for 1.0.0

Fixes #1035 
Fixes #1038 

Patch:
diff --git a/src/API/Trace/AbstractSpan.php b/src/API/Trace/AbstractSpan.php
deleted file mode 100644
index 4cc72bdd..00000000
--- a/src/API/Trace/AbstractSpan.php
+++ /dev/null
@@ -1,16 +0,0 @@
-<?php
-
-declare(strict_types=1);
-
-namespace OpenTelemetry\API\Trace;
-
-use const E_USER_DEPRECATED;
-use function sprintf;
-use function trigger_error;
-
-@trigger_error(sprintf('Using %s is deprecated, use %s instead.', AbstractSpan::class, Span::class), E_USER_DEPRECATED);
-
-/** @deprecated Use {@link \OpenTelemetry\API\Trace\Span} instead. */
-abstract class AbstractSpan extends Span
-{
-}
diff --git a/src/API/Trace/SpanContextInterface.php b/src/API/Trace/SpanContextInterface.php
index 06d7dfb6..d15bc598 100644
--- a/src/API/Trace/SpanContextInterface.php
+++ b/src/API/Trace/SpanContextInterface.php
@@ -9,11 +9,6 @@ namespace OpenTelemetry\API\Trace;
  */
 interface SpanContextInterface
 {
-    /** @deprecated */
-    public const TRACE_FLAG_SAMPLED = 0x01;
-    /** @deprecated */
-    public const TRACE_FLAG_DEFAULT = 0x00;
-
     public static function createFromRemoteParent(string $traceId, string $spanId, int $traceFlags = TraceFlags::DEFAULT, ?TraceStateInterface $traceState = null): SpanContextInterface;
     public static function getInvalid(): SpanContextInterface;
     public static function create(string $traceId, string $spanId, int $traceFlags = TraceFlags::DEFAULT, ?TraceStateInterface $traceState = null): SpanContextInterface;
diff --git a/src/SDK/Common/Dev/Compatibility/BC/ApiCommon.php b/src/SDK/Common/Dev/Compatibility/BC/ApiCommon.php
deleted file mode 100644
index acd2d211..00000000
--- a/src/SDK/Common/Dev/Compatibility/BC/ApiCommon.php
+++ /dev/null
@@ -1,46 +0,0 @@
-<?php
-
-declare(strict_types=1);
-
-namespace OpenTelemetry\SDK\Common\Dev\Compatibility\BC;
-
-use OpenTelemetry\API\Globals;
-use OpenTelemetry\API\Instrumentation\CachedInstrumentation;
-use OpenTelemetry\API\Instrumentation\Configurator;
-use OpenTelemetry\API\Instrumentation\ContextKeys;
-use OpenTelemetry\API\Instrumentation\InstrumentationInterface;
-use OpenTelemetry\API\Instrumentation\InstrumentationTrait;
-use OpenTelemetry\API\LoggerHolder;
-use OpenTelemetry\API\Signals;
-
-/**
- * @codeCoverageIgnoreStart
- */
-const OpenTelemetry_API_Common_Instrumentation_CachedInstrumentation = '\OpenTelemetry\API\Common\Instrumentation\CachedInstrumentation';
-const OpenTelemetry_API_Common_Instrumentation_Configurator = '\OpenTelemetry\API\Common\Instrumentation\Configurator';
-const OpenTelemetry_API_Common_Instrumentation_ContextKeys = '\OpenTelemetry\API\Common\Instrumentation\ContextKeys';
-const OpenTelemetry_API_Common_Instrumentation_Globals = '\OpenTelemetry\API\Common\Instrumentation\Globals';
-const OpenTelemetry_API_Common_Instrumentation_InstrumentationInterface = '\OpenTelemetry\API\Common\Instrumentation\InstrumentationInterface';
-const OpenTelemetry_API_Common_Instrumentation_InstrumentationTrait = '\OpenTelemetry\API\Common\Instrumentation\InstrumentationTrait';
-const OpenTelemetry_API_Common_Log_LoggerHolder = '\OpenTelemetry\API\Common\Log\LoggerHolder';
-const OpenTelemetry_API_Common_Signal_Signals = '\OpenTelemetry\API\Common\Signal\Signals';
-
-const MAP = [
-    OpenTelemetry_API_Common_Instrumentation_CachedInstrumentation => CachedInstrumentation::class,
-    OpenTelemetry_API_Common_Instrumentation_Configurator => Configurator::class,
-    OpenTelemetry_API_Common_Instrumentation_ContextKeys => ContextKeys::class,
-    OpenTelemetry_API_Common_Instrumentation_Globals => Globals::class,
-    OpenTelemetry_API_Common_Instrumentation_InstrumentationInterface => InstrumentationInterface::class,
-    OpenTelemetry_API_Common_Instrumentation_InstrumentationTrait => InstrumentationTrait::class,
-    OpenTelemetry_API_Common_Log_LoggerHolder => LoggerHolder::class,
-    OpenTelemetry_API_Common_Signal_Signals => Signals::class,
-];
-
-foreach (MAP as $old => $new) {
-    if (!class_exists($old, false)) {
-        class_alias($new, $old);
-    }
-}
-/**
- * @codeCoverageIgnoreEnd
- */
diff --git a/src/SDK/Common/Dev/Compatibility/BC/LogRecordProcessors.php b/src/SDK/Common/Dev/Compatibility/BC/LogRecordProcessors.php
deleted file mode 100644
index 9c92b1f9..00000000
--- a/src/SDK/Common/Dev/Compatibility/BC/LogRecordProcessors.php
+++ /dev/null
@@ -1,22 +0,0 @@
-<?php
-
-declare(strict_types=1);
-
-namespace OpenTelemetry\SDK\Common\Dev\Compatibility\BC;
-
-use OpenTelemetry\SDK\Logs\Processor\BatchLogRecordProcessor;
-use OpenTelemetry\SDK\Logs\Processor\SimpleLogRecordProcessor;
-
-const OpenTelemetry_SDK_Logs_Processor_BatchLogsProcessor = '\OpenTelemetry\SDK\Logs\Processor\BatchLogsProcessor';
-const OpenTelemetry_SDK_Logs_Processor_SimpleLogsProcessor = '\OpenTelemetry\SDK\Logs\Processor\SimpleLogsProcessor';
-
-const LR_MAP = [
-    OpenTelemetry_SDK_Logs_Processor_BatchLogsProcessor => BatchLogRecordProcessor::class,
-    OpenTelemetry_SDK_Logs_Processor_SimpleLogsProcessor => SimpleLogRecordProcessor::class,
-];
-
-foreach (LR_MAP as $old => $new) {
-    if (!class_exists($old, false)) {
-        class_alias($new, $old);
-    }
-}
diff --git a/src/SDK/Common/Dev/Compatibility/BC/OtlpExporter.php b/src/SDK/Common/Dev/Compatibility/BC/OtlpExporter.php
deleted file mode 100644
index b2ce4ac4..00000000
--- a/src/SDK/Common/Dev/Compatibility/BC/OtlpExporter.php
+++ /dev/null
@@ -1,53 +0,0 @@
-<?php
-
-declare(strict_types=1);
-
-namespace OpenTelemetry\SDK\Common\Dev\Compatibility\BC;
-
-use OpenTelemetry\SDK\Common\Future\CancellationInterface;
-use OpenTelemetry\SDK\Common\Future\ErrorFuture;
-use OpenTelemetry\SDK\Common\Future\FutureInterface;
-use OpenTelemetry\SDK\Trace\SpanExporterInterface;
-use RuntimeException;
-
-class OtlpExporter implements SpanExporterInterface
-{
-    private static string $message = 'Class has been replaced by Contrib\Otlp\SpanExporter + Transports';
-
-    private static function error(): void
-    {
-        trigger_error(self::$message, E_USER_ERROR);
-    }
-
-    public static function fromConnectionString(string $endpointUrl, string $name, string $args)
-    {
-        self::error();
-    }
-
-    public function export(iterable $batch, ?CancellationInterface $cancellation = null): FutureInterface
-    {
-        self::error();
-
-        return new ErrorFuture(new RuntimeException('class is deprecated'));
-    }
-
-    public function shutdown(?CancellationInterface $cancellation = null): bool
-    {
-        self::error();
-
-        return false;
-    }
-
-    public function forceFlush(?CancellationInterface $cancellation = null): bool
-    {
-        self::error();
-
-        return false;
-    }
-}
-
-if (!class_exists('OpenTelemetry\Contrib\Otlp\Exporter', false)) {
-    class_alias(OtlpExporter::class, 'OpenTelemetry\Contrib\OtlpGrpc\Exporter');
-    class_alias(OtlpExporter::class, 'OpenTelemetry\Contrib\OtlpHttp\Exporter');
-    class_alias(OtlpExporter::class, 'OpenTelemetry\Contrib\Otlp\Exporter');
-}
diff --git a/src/SDK/Common/Dev/Compatibility/_load.php b/src/SDK/Common/Dev/Compatibility/_load.php
index a7aea5bb..99f86c57 100644
--- a/src/SDK/Common/Dev/Compatibility/_load.php
+++ b/src/SDK/Common/Dev/Compatibility/_load.php
@@ -1,7 +1,7 @@
 <?php
 
 declare(strict_types=1);
-
-require_once __DIR__ . '/BC/OtlpExporter.php';
-require_once __DIR__ . '/BC/ApiCommon.php';
-require_once __DIR__ . '/BC/LogRecordProcessors.php';
+/**
+ * To add a BC compatibility:
+ * require_once __DIR__ . '/BC/SomeFile.php';
+ */
diff --git a/src/SDK/Common/Dsn/Dsn.php b/src/SDK/Common/Dsn/Dsn.php
deleted file mode 100644
index 25010da6..00000000
--- a/src/SDK/Common/Dsn/Dsn.php
+++ /dev/null
@@ -1,197 +0,0 @@
-<?php
-
-declare(strict_types=1);
-
-namespace OpenTelemetry\SDK\Common\Dsn;
-
-/**
- * @deprecated
- * @phan-suppress PhanDeprecatedInterface
- */
-class Dsn implements DsnInterface
-{
-    private string $type;
-    private string $protocol;
-    private string $host;
-    private ?string $path;
-    private ?int $port;
-    private array $options;
-    private ?string $user;
-    private ?string $password;
-    private string $endpoint;
-    private string $scheme;
-
-    public function __construct(
-        string $type,
-        string $scheme,
-        string $host,
-        ?string $path = null,
-        ?int $port = null,
-        ?array $options = null,
-        ?string $user = null,
-        ?string $password = null
-    ) {
-        $this->type = $type;
-        $this->scheme = $scheme;
-        $this->host = $host;
-        $this->path = $path;
-        $this->port = $port;
-        $this->options = $options ?? [];
-        $this->user = $user;
-        $this->password = $password;
-    }
-
-    /**
-     * @phan-suppress PhanDeprecatedClass
-     */
-    public static function create(
-        string $type,
-        string $scheme,
-        string $host,
-        ?string $path = null,
-        ?int $port = null,
-        ?array $options = null,
-        ?string $user = null,
-        ?string $password = null
-    ): self {
-        return new self($type, $scheme, $host, $path, $port, $options, $user, $password);
-    }
-
-    public function __toString(): string
-    {
-        $dsn = sprintf(
-            '%s+%s',
-            $this->getType(),
-            $this->getEndpoint()
-        );
-
-        return $dsn . (empty($this->getOptions()) ? '' : '?' . http_build_query($this->getOptions()));
-    }
-
-    /**
-     * @inheritDoc
-     */
-    public function getEndpoint(): string
-    {
-        /** @psalm-suppress RedundantPropertyInitializationCheck */
-        return $this->endpoint ??= $this->renderEndpoint();
-    }
-
-    public function asConfigArray(): array
-    {
-        return [
-            DsnInterface::TYPE_ATTRIBUTE => $this->getType(),
-            DsnInterface::URL_ATTRIBUTE => $this->getEndpoint(),
-            DsnInterface::OPTIONS_ATTRIBUTE => $this->getOptions(),
-        ];
-    }
-
-    public function getType(): string
-    {
-        return $this->type;
-    }
-
-    public function getScheme(): string
-    {
-        return $this->scheme;
-    }
-
-    public function getProtocol(): string
-    {
-        /** @psalm-suppress RedundantPropertyInitializationCheck */
-        return $this->protocol ??= $this->renderProtocol();
-    }
-
-    public function getHost(): string
-    {
-        return $this->host;
-    }
-
-    public function getPath(): ?string
-    {
-        return $this->path;
-    }
-
-    public function getPort(): ?int
-    {
-        return $this->port;
-    }
-
-    public function getOptions(): array
-    {
-        return $this->options;
-    }
-
-    public function getOption(string $name)
-    {
-        return $this->options[$name] ?? null;
-    }
-
-    public function getUser(): ?string
-    {
-        return $this->user;
-    }
-
-    public function getPassword(): ?string
-    {
-        return $this->password;
-    }
-
-    private function renderProtocol(): string
-    {
-        return sprintf('%s+%s', $this->getType(), $this->getScheme());
-    }
-
-    private function renderEndpoint(): string
-    {
-        $dsn = $this->renderScheme();
-
-        $dsn .= $this->renderUserInfo();
-        $dsn .= $this->getHost();
-        $dsn .= $this->renderPort();
-
-        return $dsn . ($this->getPath() ?? '');
-    }
-
-    private function renderScheme(): string
-    {
-        return sprintf(
-            '%s://',
-            $this->getScheme()
-        );
-    }
-
-    /**
-     * @phan-suppress PhanTypeMismatchArgumentNullableInternal
-     * @psalm-suppress PossiblyNullArgument
-     */
-    private function renderUserInfo(): string
-    {
-        if ($this->getUser() === null) {
-            return '';
-        }
-
-        return $this->getPassword() !== null
-            ? sprintf(
-                '%s:%s@',
-                $this->getUser(),
-                $this->getPassword()
-            )
-            : sprintf(
-                '%s@',
-                $this->getUser()
-            );
-    }
-
-    /**
-     * @phan-suppress PhanTypeMismatchArgumentNullableInternal
-     * @psalm-suppress PossiblyNullArgument
-     */
-    private function renderPort(): string
-    {
-        return $this->getPort() !== null ? sprintf(
-            ':%s',
-            $this->getPort(),
-        ) : '';
-    }
-}
diff --git a/src/SDK/Common/Dsn/DsnInterface.php b/src/SDK/Common/Dsn/DsnInterface.php
deleted file mode 100644
index ad9de7a0..00000000
--- a/src/SDK/Common/Dsn/DsnInterface.php
+++ /dev/null
@@ -1,68 +0,0 @@
-<?php
-
-declare(strict_types=1);
-
-namespace OpenTelemetry\SDK\Common\Dsn;
-
-/**
- * @deprecated
- */
-interface DsnInterface
-{
-    /** @var string  */
-    public const TYPE_ATTRIBUTE = 'type';
-    /** @var string  */
-    public const PROTOCOL_ATTRIBUTE = 'protocol';
-    /** @var string  */
-    public const SCHEME_ATTRIBUTE = 'scheme';
-    /** @var string  */
-    public const HOST_ATTRIBUTE = 'host';
-    /** @var string  */
-    public const PATH_ATTRIBUTE = 'path';
-    /** @var string  */
-    public const PORT_ATTRIBUTE = 'port';
-    /** @var string  */
-    public const OPTIONS_ATTRIBUTE = 'options';
-    /** @var string  */
-    public const USER_ATTRIBUTE = 'user';
-    /** @var string  */
-    public const PASSWORD_ATTRIBUTE = 'password';
-    /** @var string  */
-    public const URL_ATTRIBUTE = 'url';
-
-    /** @var string[]  */
-    public const CONFIG_ATTRIBUTES = [
-        DsnInterface::TYPE_ATTRIBUTE,
-        DsnInterface::URL_ATTRIBUTE,
-        DsnInterface::OPTIONS_ATTRIBUTE,
-    ];
-
-    /**
-     * Returns the endpoint (DSN without type and options)
-     */
-    public function getEndpoint(): string;
-
-    public function asConfigArray(): array;
-
-    public function getType(): string;
-
-    public function getProtocol(): string;
-
-    public function getScheme(): string;
-
-    public function getHost(): string;
-
-    public function getPath(): ?string;
-
-    public function getPort(): ?int;
-
-    public function getOptions(): array;
-
-    public function getOption(string $name);
-
-    public function getUser(): ?string;
-
-    public function getPassword(): ?string;
-
-    public function __toString(): string;
-}
diff --git a/src/SDK/Common/Dsn/Factory.php b/src/SDK/Common/Dsn/Factory.php
deleted file mode 100644
index 2cafa03f..00000000
--- a/src/SDK/Common/Dsn/Factory.php
+++ /dev/null
@@ -1,75 +0,0 @@
-<?php
-
-declare(strict_types=1);
-
-namespace OpenTelemetry\SDK\Common\Dsn;
-
-use InvalidArgumentException;
-
-/**
- * @phan-suppress PhanDeprecatedInterface
- * @phan-suppress PhanDeprecatedClass
- */
-final class Factory implements FactoryInterface
-{
-    /** @var array  */
-    public const REQUIRED_ATTRIBUTES = [
-        DsnInterface::TYPE_ATTRIBUTE,
-        DsnInterface::SCHEME_ATTRIBUTE,
-        DsnInterface::HOST_ATTRIBUTE,
-    ];
-
-    private array $defaults;
-
-    public function __construct(array $defaults = [])
-    {
-        $this->defaults = $defaults;
-    }
-
-    public static function create(array $defaults = []): self
-    {
-        return new self($defaults);
-    }
-
-    /**
-     * @phan-suppress PhanUndeclaredClassAttribute
-     * @phan-suppress PhanDeprecatedClass
-     */
-    #[\ReturnTypeWillChange]
-    public function fromArray(array $dsn): Dsn
-    {
-        return new Dsn(
-            $this->getValue(DsnInterface::TYPE_ATTRIBUTE, $dsn),
-            $this->getValue(DsnInterface::SCHEME_ATTRIBUTE, $dsn),
-            $this->getValue(DsnInterface::HOST_ATTRIBUTE, $dsn),
-            $this->getValue(DsnInterface::PATH_ATTRIBUTE, $dsn),
-            $this->getValue(DsnInterface::PORT_ATTRIBUTE, $dsn),
-            $this->getValue(DsnInterface::OPTIONS_ATTRIBUTE, $dsn, []),
-            $this->getValue(DsnInterface::USER_ATTRIBUTE, $dsn),
-            $this->getValue(DsnInterface::PASSWORD_ATTRIBUTE, $dsn)
-        );
-    }
-
-    private function getValue(string $name, array $dsn, $default = null)
-    {
-        return in_array($name, self::REQUIRED_ATTRIBUTES, true)
-            ? $this->requireValue($name, $dsn)
-            : $this->resolveValue($name, $dsn, $default);
-    }
-
-    private function resolveValue(string $name, array $dsn, $default = null)
-    {
-        return $dsn[$name] ?? $this->defaults[$name] ?? $default;
-    }
-
-    private function requireValue(string $name, array $dsn)
-    {
-        if (($value = $this->resolveValue($name, $dsn)) === null) {
-            throw new InvalidArgumentException(
-                'Exporter DSN array must have entry: ' . $name
-            );
-        }
-
-        return $value;
-    }
-}
diff --git a/src/SDK/Common/Dsn/FactoryInterface.php b/src/SDK/Common/Dsn/FactoryInterface.php
deleted file mode 100644
index a42a5f16..00000000
--- a/src/SDK/Common/Dsn/FactoryInterface.php
+++ /dev/null
@@ -1,13 +0,0 @@
-<?php
-
-declare(strict_types=1);
-
-namespace OpenTelemetry\SDK\Common\Dsn;
-
-/**
- * @deprecated
- */
-interface FactoryInterface
-{
-    public function fromArray(array $dsn): DsnInterface;
-}
diff --git a/src/SDK/Common/Dsn/Parser.php b/src/SDK/Common/Dsn/Parser.php
deleted file mode 100644
index 7d48d8be..00000000
--- a/src/SDK/Common/Dsn/Parser.php
+++ /dev/null
@@ -1,107 +0,0 @@
-<?php
-
-declare(strict_types=1);
-
-namespace OpenTelemetry\SDK\Common\Dsn;
-
-use InvalidArgumentException;
-
-/**
- * @deprecated
- * @phan-suppress PhanDeprecatedInterface
- * @phan-suppress PhanDeprecatedClass
- */
-class Parser implements ParserInterface
-{
-    private const QUERY_ATTRIBUTE = 'query';
-    private const PASS_ATTRIBUTE = 'pass';
-    private const SCHEME_ATTRIBUTE = 'scheme';
-
-    private FactoryInterface $factory;
-
-    public function __construct(FactoryInterface $factory = null)
-    {
-        $this->factory = $factory ?? Factory::create();
-    }
-
-    /**
-     * @phan-suppress PhanDeprecatedClass
-     */
-    public static function create(FactoryInterface $factory = null): self
-    {
-        return new self($factory);
-    }
-
-    public function parse(string $dsn): DsnInterface
-    {
-        return $this->factory->fromArray(
-            $this->parseToArray($dsn)
-        );
-    }
-
-    public function parseToArray(string $dsn): array
-    {
-        return self::resolvePassword(
-            self::resolveOptions(
-                self::parseDsnString($dsn)
-            )
-        );
-    }
-
-    private static function parseDsnString(string $dsn): array
-    {
-        if (($components = parse_url($dsn)) === false) {
-            throw new InvalidArgumentException('Could not parse DSN');
-        }
-
-        self::validateComponents($components);
-
-        [$components[DsnInterface::TYPE_ATTRIBUTE], $components[DsnInterface::SCHEME_ATTRIBUTE]]
-            = explode('+', $components[DsnInterface::SCHEME_ATTRIBUTE] ?? '+');
-
-        $components[DsnInterface::PATH_ATTRIBUTE] ??= null;
-        $components[DsnInterface::PORT_ATTRIBUTE] ??= null;
-        $components[DsnInterface::USER_ATTRIBUTE] ??= null;
-
-        return $components;
-    }
-
-    private static function validateComponents(array $components): void
-    {
-        if (!isset($components[self::SCHEME_ATTRIBUTE])
-            || (int) strpos($components[self::SCHEME_ATTRIBUTE], '+') === 0) {
-            throw new InvalidArgumentException(
-                'An exporter DSN must have a exporter type and a scheme: type+scheme://host:port'
-            );
-        }
-    }
-
-    private static function resolveOptions(array $components): array
-    {
-        $components[DsnInterface::OPTIONS_ATTRIBUTE] = [];
-        if (isset($components[self::QUERY_ATTRIBUTE])) {
-            foreach (explode('&', $components[self::QUERY_ATTRIBUTE]) as $part) {
-                [$key, $value] = explode('=', $part);
-                $components[DsnInterface::OPTIONS_ATTRIBUTE][$key] = $value;
-            }
-        }
-
-        unset($components[self::QUERY_ATTRIBUTE]);
-
-        return $components;
-    }
-
-    private static function resolvePassword(array $components): array
-    {
-        if (!isset($components[self::PASS_ATTRIBUTE])) {
-            $components[DsnInterface::PASSWORD_ATTRIBUTE] = null;
-
-            return $components;
-        }
-
-        $components[DsnInterface::PASSWORD_ATTRIBUTE] = $components[self::PASS_ATTRIBUTE];
-        unset($components[self::PASS_ATTRIBUTE]);
-
-        return $components;
-    }
-}
diff --git a/src/SDK/Common/Dsn/ParserInterface.php b/src/SDK/Common/Dsn/ParserInterface.php
deleted file mode 100644
index 21ea3e47..00000000
--- a/src/SDK/Common/Dsn/ParserInterface.php
+++ /dev/null
@@ -1,15 +0,0 @@
-<?php
-
-declare(strict_types=1);
-
-namespace OpenTelemetry\SDK\Common\Dsn;
-
-/**
- * @deprecated
- */
-interface ParserInterface
-{
-    public function parse(string $dsn): DsnInterface;
-
-    public function parseToArray(string $dsn): array;
-}
diff --git a/src/SDK/Common/Time/ClockInterface.php b/src/SDK/Common/Time/ClockInterface.php
index b3274e60..8f317018 100644
--- a/src/SDK/Common/Time/ClockInterface.php
+++ b/src/SDK/Common/Time/ClockInterface.php
@@ -16,9 +16,4 @@ interface ClockInterface
      * Returns the current epoch wall-clock timestamp in nanoseconds
      */
     public function now(): int;
-
-    /**
-     * @deprecated
-     */
-    public function nanoTime(): int;
 }
diff --git a/src/SDK/Common/Time/SystemClock.php b/src/SDK/Common/Time/SystemClock.php
index ea06743d..f57e9849 100644
--- a/src/SDK/Common/Time/SystemClock.php
+++ b/src/SDK/Common/Time/SystemClock.php
@@ -9,7 +9,6 @@ use function microtime;
 
 final class SystemClock implements ClockInterface
 {
-    private static ?self $instance = null;
     private static int $referenceTime = 0;
 
     public function __construct()
@@ -17,18 +16,6 @@ final class SystemClock implements ClockInterface
         self::init();
     }
 
-    /**
-     * @deprecated
-     */
-    public static function getInstance(): self
-    {
-        if (null === self::$instance) {
-            self::$instance = new self();
-        }
-
-        return self::$instance;
-    }
-
     public static function create(): self
     {
         return new self();
@@ -40,14 +27,6 @@ final class SystemClock implements ClockInterface
         return self::$referenceTime + hrtime(true);
     }
 
-    /**
-     * @deprecated
-     */
-    public function nanoTime(): int
-    {
-        return $this->now();
-    }
-
     private static function init(): void
     {
         if (self::$referenceTime > 0) {
diff --git a/src/SDK/Metrics/MeterProviderBuilder.php b/src/SDK/Metrics/MeterProviderBuilder.php
index 3567fd0e..17f0be89 100644
--- a/src/SDK/Metrics/MeterProviderBuilder.php
+++ b/src/SDK/Metrics/MeterProviderBuilder.php
@@ -21,16 +21,6 @@ class MeterProviderBuilder
     private ?ResourceInfo $resource = null;
     private ?ExemplarFilterInterface $exemplarFilter = null;
 
-    /**
-     * @deprecated
-     */
-    public function registerMetricReader(MetricReaderInterface $reader): self
-    {
-        $this->metricReaders[] = $reader;
-
-        return $this;
-    }
-
     public function setResource(ResourceInfo $resource): self
     {
         $this->resource = $resource;
diff --git a/src/SDK/Resource/ResourceInfoFactory.php b/src/SDK/Resource/ResourceInfoFactory.php
index 25d2d158..7fc80bcd 100644
--- a/src/SDK/Resource/ResourceInfoFactory.php
+++ b/src/SDK/Resource/ResourceInfoFactory.php
@@ -17,23 +17,6 @@ class ResourceInfoFactory
 {
     use LogsMessagesTrait;
 
-    /**
-     * Merges resources into a new one.
-     *
-     * @deprecated Use `ResourceInfo::merge($resource)`
-     * @phan-suppress PhanDeprecatedFunction
-     * @see https://github.com/open-telemetry/opentelemetry-specification/blob/v1.20.0/specification/resource/sdk.md#merge
-     */
-    public static function merge(ResourceInfo ...$resources): ResourceInfo
-    {
-        $merged = ResourceInfoFactory::emptyResource();
-        foreach ($resources as $resource) {
-            $merged = $merged->merge($resource);
-        }
-
-        return $merged;
-    }
-
     public static function defaultResource(): ResourceInfo
     {
         $detectors = Configuration::getList(Env::OTEL_PHP_DETECTORS);


Test patch:
diff --git a/tests/Unit/SDK/Common/Dsn/DsnTest.php b/tests/Unit/SDK/Common/Dsn/DsnTest.php
deleted file mode 100644
index 75703f47..00000000
--- a/tests/Unit/SDK/Common/Dsn/DsnTest.php
+++ /dev/null
@@ -1,274 +0,0 @@
-<?php
-
-declare(strict_types=1);
-
-namespace OpenTelemetry\Tests\Unit\SDK\Common\Dsn;
-
-use Generator;
-use OpenTelemetry\SDK\Common\Dsn\Dsn;
-use OpenTelemetry\SDK\Common\Dsn\DsnInterface;
-use PHPUnit\Framework\TestCase;
-
-/**
- * @covers \OpenTelemetry\SDK\Common\Dsn\Dsn
- */
-class DsnTest extends TestCase
-{
-    private const ARGUMENTS = [
-        DsnInterface::TYPE_ATTRIBUTE => 'foo',
-        DsnInterface::SCHEME_ATTRIBUTE => 'bar',
-        DsnInterface::HOST_ATTRIBUTE => 'example.com',
-        DsnInterface::PATH_ATTRIBUTE => '/path',
-        DsnInterface::PORT_ATTRIBUTE => 42,
-        DsnInterface::OPTIONS_ATTRIBUTE => ['key' => 'value'],
-        DsnInterface::USER_ATTRIBUTE => 'root',
-        DsnInterface::PASSWORD_ATTRIBUTE => 'secret',
-    ];
-
-    /**
-     * @dataProvider provideArguments
-     */
-    public function test_getters(string $getter, $value): void
-    {
-        $this->assertSame(
-            $value,
-            $this->createInstance()->{$getter}()
-        );
-    }
-
-    /**
-     * @dataProvider provideToStringValues
-     */
-    public function test_to_string(string $dsn, array $droppedArguments): void
-    {
-        $this->assertSame(
-            $dsn,
-            (string) $this->createInstance($droppedArguments)
-        );
-    }
-
-    /**
-     * @dataProvider provideEndpointValues
-     */
-    public function test_get_endpoint(string $uri, array $droppedArguments): void
-    {
-        $this->assertSame(
-            $uri,
-            $this->createInstance($droppedArguments)->getEndpoint()
-        );
-    }
-
-    public function test_as_config_array(): void
-    {
-        $this->assertSame(
-            [
-                'type' => 'foo',
-                'url' => 'bar://root:secret@example.com:42/path',
-                'options' => ['key'=>'value'],
-            ],
-            $this->createInstance()->asConfigArray()
-        );
-    }
-
-    /**
-     * @psalm-suppress PossiblyInvalidArgument
-     */
-    private function createInstance(array $droppedArguments = []): Dsn
-    {
-        $arguments = self::ARGUMENTS;
-
-        foreach ($droppedArguments as $argument) {
-            $arguments[$argument] = null;
-        }
-
-        return Dsn::create(
-            $arguments[DsnInterface::TYPE_ATTRIBUTE],
-            $arguments[DsnInterface::SCHEME_ATTRIBUTE],
-            $arguments[DsnInterface::HOST_ATTRIBUTE],
-            $arguments[DsnInterface::PATH_ATTRIBUTE],
-            $arguments[DsnInterface::PORT_ATTRIBUTE],
-            $arguments[DsnInterface::OPTIONS_ATTRIBUTE],
-            $arguments[DsnInterface::USER_ATTRIBUTE],
-            $arguments[DsnInterface::PASSWORD_ATTRIBUTE]
-        );
-    }
-
-    public function provideArguments(): Generator
-    {
-        foreach (self::ARGUMENTS as $name => $value) {
-            yield ['get' . ucfirst($name), $value];
-        }
-    }
-
-    public function provideToStringValues(): Generator
-    {
-        // all
-        yield ['foo+bar://root:secret@example.com:42/path?key=value', []];
-        // no path
-        yield ['foo+bar://root:secret@example.com:42?key=value', [
-            DsnInterface::PATH_ATTRIBUTE,
-        ]];
-        // no path, port
-        yield ['foo+bar://root:secret@example.com?key=value', [
-            DsnInterface::PATH_ATTRIBUTE,
-            DsnInterface::PORT_ATTRIBUTE,
-        ]];
-        // no path, port, options
-        yield ['foo+bar://root:secret@example.com', [
-            DsnInterface::PATH_ATTRIBUTE,
-            DsnInterface::PORT_ATTRIBUTE,
-            DsnInterface::OPTIONS_ATTRIBUTE,
-        ]];
-        // no path, port, options, user
-        yield ['foo+bar://example.com', [
-            DsnInterface::PATH_ATTRIBUTE,
-            DsnInterface::PORT_ATTRIBUTE,
-            DsnInterface::OPTIONS_ATTRIBUTE,
-            DsnInterface::USER_ATTRIBUTE,
-        ]];
-        // no path, port, options, user, password
-        yield ['foo+bar://example.com', [
-            DsnInterface::PATH_ATTRIBUTE,
-            DsnInterface::PORT_ATTRIBUTE,
-            DsnInterface::OPTIONS_ATTRIBUTE,
-            DsnInterface::USER_ATTRIBUTE,
-            DsnInterface::PASSWORD_ATTRIBUTE,
-        ]];
-        // no port
-        yield ['foo+bar://root:secret@example.com/path?key=value', [
-            DsnInterface::PORT_ATTRIBUTE,
-        ]];
-        // no port, options
-        yield ['foo+bar://root:secret@example.com/path', [
-            DsnInterface::PORT_ATTRIBUTE,
-            DsnInterface::OPTIONS_ATTRIBUTE,
-        ]];
-        // no port, options, user
-        yield ['foo+bar://example.com/path', [
-            DsnInterface::PORT_ATTRIBUTE,
-            DsnInterface::OPTIONS_ATTRIBUTE,
-            DsnInterface::USER_ATTRIBUTE,
-        ]];
-        // no port, options, user, password
-        yield ['foo+bar://example.com/path', [
-            DsnInterface::PORT_ATTRIBUTE,
-            DsnInterface::OPTIONS_ATTRIBUTE,
-            DsnInterface::USER_ATTRIBUTE,
-            DsnInterface::PASSWORD_ATTRIBUTE,
-        ]];
-        // no options,
-        yield ['foo+bar://root:secret@example.com:42/path', [
-            DsnInterface::OPTIONS_ATTRIBUTE,
-        ]];
-        // no options, user
-        yield ['foo+bar://example.com:42/path', [
-            DsnInterface::OPTIONS_ATTRIBUTE,
-            DsnInterface::USER_ATTRIBUTE,
-        ]];
-        // no options, user, password
-        yield ['foo+bar://example.com:42/path', [
-            DsnInterface::OPTIONS_ATTRIBUTE,
-            DsnInterface::USER_ATTRIBUTE,
-            DsnInterface::PASSWORD_ATTRIBUTE,
-        ]];
-        // no user
-        yield ['foo+bar://example.com:42/path?key=value', [
-            DsnInterface::USER_ATTRIBUTE,
-        ]];
-        // no user, password
-        yield ['foo+bar://example.com:42/path?key=value', [
-            DsnInterface::USER_ATTRIBUTE,
-            DsnInterface::PASSWORD_ATTRIBUTE,
-        ]];
-        // no password
-        yield ['foo+bar://root@example.com:42/path?key=value', [
-            DsnInterface::PASSWORD_ATTRIBUTE,
-        ]];
-    }
-
-    public function provideEndpointValues(): Generator
-    {
-        // all
-        yield ['bar://root:secret@example.com:42/path', []];
-        // no path
-        yield ['bar://root:secret@example.com:42', [
-            DsnInterface::PATH_ATTRIBUTE,
-        ]];
-        // no path, port
-        yield ['bar://root:secret@example.com', [
-            DsnInterface::PATH_ATTRIBUTE,
-            DsnInterface::PORT_ATTRIBUTE,
-        ]];
-        // no path, port, options
-        yield ['bar://root:secret@example.com', [
-            DsnInterface::PATH_ATTRIBUTE,
-            DsnInterface::PORT_ATTRIBUTE,
-            DsnInterface::OPTIONS_ATTRIBUTE,
-        ]];
-        // no path, port, options, user
-        yield ['bar://example.com', [
-            DsnInterface::PATH_ATTRIBUTE,
-            DsnInterface::PORT_ATTRIBUTE,
-            DsnInterface::OPTIONS_ATTRIBUTE,
-            DsnInterface::USER_ATTRIBUTE,
-        ]];
-        // no path, port, options, user, password
-        yield ['bar://example.com', [
-            DsnInterface::PATH_ATTRIBUTE,
-            DsnInterface::PORT_ATTRIBUTE,
-            DsnInterface::OPTIONS_ATTRIBUTE,
-            DsnInterface::USER_ATTRIBUTE,
-            DsnInterface::PASSWORD_ATTRIBUTE,
-        ]];
-        // no port
-        yield ['bar://root:secret@example.com/path', [
-            DsnInterface::PORT_ATTRIBUTE,
-        ]];
-        // no port, options
-        yield ['bar://root:secret@example.com/path', [
-            DsnInterface::PORT_ATTRIBUTE,
-            DsnInterface::OPTIONS_ATTRIBUTE,
-        ]];
-        // no port, options, user
-        yield ['bar://example.com/path', [
-            DsnInterface::PORT_ATTRIBUTE,
-            DsnInterface::OPTIONS_ATTRIBUTE,
-            DsnInterface::USER_ATTRIBUTE,
-        ]];
-        // no port, options, user, password
-        yield ['bar://example.com/path', [
-            DsnInterface::PORT_ATTRIBUTE,
-            DsnInterface::OPTIONS_ATTRIBUTE,
-            DsnInterface::USER_ATTRIBUTE,
-            DsnInterface::PASSWORD_ATTRIBUTE,
-        ]];
-        // no options,
-        yield ['bar://root:secret@example.com:42/path', [
-            DsnInterface::OPTIONS_ATTRIBUTE,
-        ]];
-        // no options, user
-        yield ['bar://example.com:42/path', [
-            DsnInterface::OPTIONS_ATTRIBUTE,
-            DsnInterface::USER_ATTRIBUTE,
-        ]];
-        // no options, user, password
-        yield ['bar://example.com:42/path', [
-            DsnInterface::OPTIONS_ATTRIBUTE,
-            DsnInterface::USER_ATTRIBUTE,
-            DsnInterface::PASSWORD_ATTRIBUTE,
-        ]];
-        // no user
-        yield ['bar://example.com:42/path', [
-            DsnInterface::USER_ATTRIBUTE,
-        ]];
-        // no user, password
-        yield ['bar://example.com:42/path', [
-            DsnInterface::USER_ATTRIBUTE,
-            DsnInterface::PASSWORD_ATTRIBUTE,
-        ]];
-        // no password
-        yield ['bar://root@example.com:42/path', [
-            DsnInterface::PASSWORD_ATTRIBUTE,
-        ]];
-    }
-}
diff --git a/tests/Unit/SDK/Common/Dsn/FactoryTest.php b/tests/Unit/SDK/Common/Dsn/FactoryTest.php
deleted file mode 100644
index 2056445f..00000000
--- a/tests/Unit/SDK/Common/Dsn/FactoryTest.php
+++ /dev/null
@@ -1,84 +0,0 @@
-<?php
-
-declare(strict_types=1);
-
-namespace OpenTelemetry\Tests\Unit\SDK\Common\Dsn;
-
-use Generator;
-use InvalidArgumentException;
-use OpenTelemetry\SDK\Common\Dsn\DsnInterface;
-use OpenTelemetry\SDK\Common\Dsn\Factory;
-use PHPUnit\Framework\TestCase;
-
-/**
- * @covers \OpenTelemetry\SDK\Common\Dsn\Factory
- */
-class FactoryTest extends TestCase
-{
-    private const ARGUMENTS = [
-        DsnInterface::TYPE_ATTRIBUTE => 'foo',
-        DsnInterface::SCHEME_ATTRIBUTE => 'bar',
-        DsnInterface::HOST_ATTRIBUTE => 'example.com',
-        DsnInterface::PATH_ATTRIBUTE => '/path',
-        DsnInterface::PORT_ATTRIBUTE => 42,
-        DsnInterface::OPTIONS_ATTRIBUTE => ['key' => 'value'],
-        DsnInterface::USER_ATTRIBUTE => 'root',
-        DsnInterface::PASSWORD_ATTRIBUTE => 'secret',
-    ];
-
-    /**
-     * @dataProvider provideArguments
-     */
-    public function test_default_values(string $getter, $value): void
-    {
-        $factory = Factory::create(
-            self::ARGUMENTS
-        );
-
-        $this->assertSame(
-            $value,
-            $factory->fromArray([])
-                ->{$getter}()
-        );
-    }
-
-    /**
-     * @dataProvider provideArguments
-     */
-    public function test_from_array(string $getter, $value): void
-    {
-        $this->assertSame(
-            $value,
-            Factory::create()
-                ->fromArray(self::ARGUMENTS)
-                ->{$getter}()
-        );
-    }
-
-    /**
-     * @dataProvider provideMissingAttributeValues
-     */
-    public function test_exception_on_missing_attributes(array $arguments): void
-    {
-        $this->expectException(InvalidArgumentException::class);
-
-        Factory::create()->fromArray($arguments);
-    }
-
-    public function provideArguments(): Generator
-    {
-        foreach (self::ARGUMENTS as $name => $value) {
-            yield ['get' . ucfirst($name), $value];
-        }
-    }
-
-    public function provideMissingAttributeValues(): Generator
-    {
-        foreach (Factory::REQUIRED_ATTRIBUTES as $name) {
-            $arguments = self::ARGUMENTS;
-            unset($arguments[$name]);
-
-            yield [$arguments];
-        }
-    }
-}
diff --git a/tests/Unit/SDK/Common/Dsn/ParserTest.php b/tests/Unit/SDK/Common/Dsn/ParserTest.php
deleted file mode 100644
index 7c5a03a3..00000000
--- a/tests/Unit/SDK/Common/Dsn/ParserTest.php
+++ /dev/null
@@ -1,173 +0,0 @@
-<?php
-
-declare(strict_types=1);
-
-namespace OpenTelemetry\Tests\Unit\SDK\Common\Dsn;
-
-use Generator;
-use InvalidArgumentException;
-use OpenTelemetry\SDK\Common\Dsn\DsnInterface;
-use OpenTelemetry\SDK\Common\Dsn\FactoryInterface;
-use OpenTelemetry\SDK\Common\Dsn\Parser;
-use PHPUnit\Framework\TestCase;
-
-/**
- * @covers \OpenTelemetry\SDK\Common\Dsn\Parser
- */
-class ParserTest extends TestCase
-{
-    private const FULL_DSN = 'foo+bar://root:secret@baz:1234/path?key=value';
-
-    private const PARTS = [
-        DsnInterface::TYPE_ATTRIBUTE => 'foo',
-        DsnInterface::SCHEME_ATTRIBUTE => 'bar',
-        DsnInterface::HOST_ATTRIBUTE => 'example.com',
-        DsnInterface::PATH_ATTRIBUTE => '/path',
-        DsnInterface::PORT_ATTRIBUTE => 42,
-        DsnInterface::OPTIONS_ATTRIBUTE => ['key' => 'value'],
-        DsnInterface::USER_ATTRIBUTE => 'root',
-        DsnInterface::PASSWORD_ATTRIBUTE => 'secret',
-    ];
-
-    private Parser $instance;
-
-    protected function setUp(): void
-    {
-        $factory = $this->createMock(FactoryInterface::class);
-        $factory->method('fromArray')
-            ->willReturn(
-                $this->createMock(DsnInterface::class)
-            );
-
-        $this->instance = Parser::create($factory);
-    }
-
-    public function test_parse(): void
-    {
-        $this->assertInstanceOf(
-            DsnInterface::class,
-            $this->instance->parse(
-                self::FULL_DSN
-            )
-        );
-    }
-
-    /**
-     * @dataProvider provideParts
-     */
-    public function test_parse_to_array(string $dsn, array $droppedParts = []): void
-    {
-        $parts = self::PARTS;
-
-        foreach ($droppedParts as $part) {
-            $parts[$part] = $part === DsnInterface::OPTIONS_ATTRIBUTE ? [] : null;
-        }
-
-        $this->assertEquals(
-            $parts,
-            $this->instance->parseToArray($dsn)
-        );
-    }
-
-    /**
-     * @dataProvider provideInvalidDsn
-     */
-    public function test_parse_to_array_throws_exception_on_missing_mandatory_part(string $dsn): void
-    {
-        $this->expectException(InvalidArgumentException::class);
-
-        $this->instance->parseToArray($dsn);
-    }
-
-    public function provideParts(): Generator
-    {
-        // all
-        yield ['foo+bar://root:secret@example.com:42/path?key=value', []];
-        // no path
-        yield ['foo+bar://root:secret@example.com:42?key=value', [
-            DsnInterface::PATH_ATTRIBUTE,
-        ]];
-        // no path, port
-        yield ['foo+bar://root:secret@example.com?key=value', [
-            DsnInterface::PATH_ATTRIBUTE,
-            DsnInterface::PORT_ATTRIBUTE,
-        ]];
-        // no path, port, options
-        yield ['foo+bar://root:secret@example.com', [
-            DsnInterface::PATH_ATTRIBUTE,
-            DsnInterface::PORT_ATTRIBUTE,
-            DsnInterface::OPTIONS_ATTRIBUTE,
-        ]];
-        // no path, port, options, password
-        yield ['foo+bar://root@example.com', [
-            DsnInterface::PATH_ATTRIBUTE,
-            DsnInterface::PORT_ATTRIBUTE,
-            DsnInterface::OPTIONS_ATTRIBUTE,
-            DsnInterface::PASSWORD_ATTRIBUTE,
-        ]];
-        // no path, port, options, user, password
-        yield ['foo+bar://example.com', [
-            DsnInterface::PATH_ATTRIBUTE,
-            DsnInterface::PORT_ATTRIBUTE,
-            DsnInterface::OPTIONS_ATTRIBUTE,
-            DsnInterface::USER_ATTRIBUTE,
-            DsnInterface::PASSWORD_ATTRIBUTE,
-        ]];
-        // no port
-        yield ['foo+bar://root:secret@example.com/path?key=value', [
-            DsnInterface::PORT_ATTRIBUTE,
-        ]];
-        // no port, options
-        yield ['foo+bar://root:secret@example.com/path', [
-            DsnInterface::PORT_ATTRIBUTE,
-            DsnInterface::OPTIONS_ATTRIBUTE,
-        ]];
-        // no port, options, password
-        yield ['foo+bar://root@example.com/path', [
-            DsnInterface::PORT_ATTRIBUTE,
-            DsnInterface::OPTIONS_ATTRIBUTE,
-            DsnInterface::PASSWORD_ATTRIBUTE,
-        ]];
-        // no port, options, user, password
-        yield ['foo+bar://example.com/path', [
-            DsnInterface::PORT_ATTRIBUTE,
-            DsnInterface::OPTIONS_ATTRIBUTE,
-            DsnInterface::USER_ATTRIBUTE,
-            DsnInterface::PASSWORD_ATTRIBUTE,
-        ]];
-        // no options,
-        yield ['foo+bar://root:secret@example.com:42/path', [
-            DsnInterface::OPTIONS_ATTRIBUTE,
-        ]];
-        // no options, password
-        yield ['foo+bar://root@example.com:42/path', [
-            DsnInterface::OPTIONS_ATTRIBUTE,
-            DsnInterface::PASSWORD_ATTRIBUTE,
-        ]];
-        // no options, user, password
-        yield ['foo+bar://example.com:42/path', [
-            DsnInterface::OPTIONS_ATTRIBUTE,
-            DsnInterface::USER_ATTRIBUTE,
-            DsnInterface::PASSWORD_ATTRIBUTE,
-        ]];
-        // no user, password
-        yield ['foo+bar://example.com:42/path?key=value', [
-            DsnInterface::USER_ATTRIBUTE,
-            DsnInterface::PASSWORD_ATTRIBUTE,
-        ]];
-        // no password
-        yield ['foo+bar://root@example.com:42/path?key=value', [
-            DsnInterface::PASSWORD_ATTRIBUTE,
-        ]];
-    }
-
-    public function provideInvalidDsn(): Generator
-    {
-        // invalid
-        yield ['http://user@:80"'];
-        // no scheme
-        yield ['root:secret@baz:1234/path'];
-        // no type
-        yield ['bar://root:secret@baz:1234/path'];
-    }
-}