Skip to content

Commit

Permalink
feat: Support newer API namespace for open-telemetry/api >= 1.0.0beta…
Browse files Browse the repository at this point in the history
…10 (#171)

* build(deps): Bump open-telemetry/api to 1.0.0beta10
* fix: Use OpenTelemetry\API instead of OpenTelemetry\API\Common

Signed-off-by: Natsuki Ikeguchi <n_ikeguchi@yumemi.co.jp>
  • Loading branch information
siketyan authored Jun 26, 2023
1 parent ce970de commit e866749
Show file tree
Hide file tree
Showing 48 changed files with 67 additions and 69 deletions.
2 changes: 1 addition & 1 deletion examples/instrumentation/Psr18/request.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use GuzzleHttp\Client;
use GuzzleHttp\Psr7\Request;
use OpenTelemetry\API\Common\Instrumentation;
use OpenTelemetry\API\Instrumentation;
use OpenTelemetry\API\Trace\Propagation\TraceContextPropagator;
use OpenTelemetry\SDK\Common\Time\ClockFactory;
use OpenTelemetry\SDK\Resource\ResourceInfoFactory;
Expand Down
1 change: 1 addition & 0 deletions src/Aws/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"prefer-stable": true,
"require": {
"php": "^7.4 || ^8.0",
"open-telemetry/api": "^1.0.0beta10",
"open-telemetry/sdk": "^1.0",
"aws/aws-sdk-php": "^3.232"
},
Expand Down
4 changes: 2 additions & 2 deletions src/Aws/src/AwsSdkInstrumentation.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

use Aws\Middleware;
use Aws\ResultInterface;
use OpenTelemetry\API\Common\Instrumentation\InstrumentationInterface;
use OpenTelemetry\API\Common\Instrumentation\InstrumentationTrait;
use OpenTelemetry\API\Instrumentation\InstrumentationInterface;
use OpenTelemetry\API\Instrumentation\InstrumentationTrait;
use OpenTelemetry\API\Trace\SpanInterface;
use OpenTelemetry\API\Trace\SpanKind;
use OpenTelemetry\API\Trace\TracerInterface;
Expand Down
2 changes: 1 addition & 1 deletion src/Aws/tests/Unit/Ecs/DetectorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
use GuzzleHttp\HandlerStack;
use GuzzleHttp\Psr7\HttpFactory;
use GuzzleHttp\Psr7\Response;
use OpenTelemetry\API\Common\Log\LoggerHolder;
use OpenTelemetry\API\LoggerHolder;
use OpenTelemetry\Aws\Ecs\DataProvider;
use OpenTelemetry\Aws\Ecs\Detector;
use OpenTelemetry\SDK\Common\Attribute\Attributes;
Expand Down
4 changes: 2 additions & 2 deletions src/HookGen/branch_merger/lib/head_content.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
}

function genUseStatements(names) {
var code = ' use OpenTelemetry\API\Common\Instrumentation\CachedInstrumentation\n';
var code = ' use OpenTelemetry\API\Instrumentation\CachedInstrumentation\n';
code += ' use OpenTelemetry\API\Trace\Span\n';
code += ' use OpenTelemetry\API\Trace\SpanBuilderInterface\n';
code += ' use OpenTelemetry\API\Trace\StatusCode\n';
Expand Down Expand Up @@ -163,4 +163,4 @@
}

</style>
</head>
</head>
4 changes: 2 additions & 2 deletions src/Instrumentation/HttpAsyncClient/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ If you are not using SDK autoloading, you will need to create and register a `Tr
require_once 'vendor/autoload.php';

$tracerProvider = /*create tracer provider*/;
$scope = \OpenTelemetry\API\Common\Instrumentation\Configurator::create()
$scope = \OpenTelemetry\API\Instrumentation\Configurator::create()
->withTracerProvider($tracerProvider)
->activate();

Expand All @@ -47,4 +47,4 @@ Parts of this auto-instrumentation library can be configured, more options are a
|-------------------------------------|---------------|-------------------------|-------------------|---------------------------------------------------------------------------------|
| OTEL_PHP_DISABLED_INSTRUMENTATIONS | [] | Instrumentation name(s) | http-async-client | Disable one or more installed auto-instrumentations, names are comma seperated. |

Configurations can be provided as environment variables, or via `php.ini` (or a file included by `php.ini`)
Configurations can be provided as environment variables, or via `php.ini` (or a file included by `php.ini`)
2 changes: 1 addition & 1 deletion src/Instrumentation/HttpAsyncClient/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"require": {
"php": "^8.0",
"ext-opentelemetry": "*",
"open-telemetry/api": "^1",
"open-telemetry/api": "^1.0.0beta10",
"open-telemetry/sem-conv": "^1",
"php-http/httplug": "^2"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
use Http\Adapter\Guzzle7\Client;
use Monolog\Handler\StreamHandler;
use Monolog\Logger;
use OpenTelemetry\API\Common\Instrumentation;
use OpenTelemetry\API\Common\Log\LoggerHolder;
use OpenTelemetry\API\Instrumentation;
use OpenTelemetry\API\LoggerHolder;
use OpenTelemetry\API\Trace\Propagation\TraceContextPropagator;
use OpenTelemetry\SDK\Common\Export\Stream\StreamTransportFactory;
use OpenTelemetry\SDK\Common\Time\ClockFactory;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

use Http\Client\HttpAsyncClient;
use Http\Promise\Promise;
use OpenTelemetry\API\Common\Instrumentation;
use OpenTelemetry\API\Common\Instrumentation\CachedInstrumentation;
use OpenTelemetry\API\Globals;
use OpenTelemetry\API\Instrumentation\CachedInstrumentation;
use OpenTelemetry\API\Trace\Span;
use OpenTelemetry\API\Trace\SpanKind;
use OpenTelemetry\API\Trace\StatusCode;
Expand Down Expand Up @@ -37,7 +37,7 @@ public static function register(): void
return null;
}

$propagator = Instrumentation\Globals::propagator();
$propagator = Globals::propagator();
$parentContext = Context::getCurrent();

/** @psalm-suppress ArgumentTypeCoercion */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
use Http\Promise\Promise;
use Nyholm\Psr7\Request;
use Nyholm\Psr7\Response;
use OpenTelemetry\API\Common\Instrumentation\Configurator;
use OpenTelemetry\API\Instrumentation\Configurator;
use OpenTelemetry\API\Trace\Propagation\TraceContextPropagator;
use OpenTelemetry\Context\ScopeInterface;
use OpenTelemetry\SDK\Trace\SpanExporter\InMemoryExporter;
Expand Down
4 changes: 2 additions & 2 deletions src/Instrumentation/IO/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ See https://github.com/open-telemetry/opentelemetry-php#sdk-autoloading
require_once 'vendor/autoload.php';

$tracerProvider = /*create tracer provider*/;
$scope = \OpenTelemetry\API\Common\Instrumentation\Configurator::create()
$scope = \OpenTelemetry\API\Instrumentation\Configurator::create()
->withTracerProvider($tracerProvider)
->activate();

Expand Down Expand Up @@ -68,4 +68,4 @@ Parts of this auto-instrumentation library can be configured, more options are a
|-------------------------------------|---------------|-------------------------|---------|---------------------------------------------------------------------------------|
| OTEL_PHP_DISABLED_INSTRUMENTATIONS | [] | Instrumentation name(s) | io | Disable one or more installed auto-instrumentations, names are comma seperated. |

Configurations can be provided as environment variables, or via `php.ini` (or a file included by `php.ini`)
Configurations can be provided as environment variables, or via `php.ini` (or a file included by `php.ini`)
2 changes: 1 addition & 1 deletion src/Instrumentation/IO/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"require": {
"php": "^8.2",
"ext-opentelemetry": "*",
"open-telemetry/api": "^1",
"open-telemetry/api": "^1.0.0beta10",
"open-telemetry/sem-conv": "^1"
},
"require-dev": {
Expand Down
2 changes: 1 addition & 1 deletion src/Instrumentation/IO/src/IOInstrumentation.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace OpenTelemetry\Contrib\Instrumentation\IO;

use OpenTelemetry\API\Common\Instrumentation\CachedInstrumentation;
use OpenTelemetry\API\Instrumentation\CachedInstrumentation;
use OpenTelemetry\API\Trace\Span;
use OpenTelemetry\API\Trace\SpanBuilderInterface;
use OpenTelemetry\API\Trace\StatusCode;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
namespace OpenTelemetry\Tests\Instrumentation\IO\tests\Integration;

use ArrayObject;
use OpenTelemetry\API\Common\Instrumentation\Configurator;
use OpenTelemetry\API\Instrumentation\Configurator;
use OpenTelemetry\Context\ScopeInterface;
use OpenTelemetry\SDK\Trace\ImmutableSpan;
use OpenTelemetry\SDK\Trace\SpanExporter\InMemoryExporter;
Expand Down
4 changes: 2 additions & 2 deletions src/Instrumentation/Laravel/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ See https://github.com/open-telemetry/opentelemetry-php#sdk-autoloading
require_once 'vendor/autoload.php';

$tracerProvider = /*create tracer provider*/;
$scope = \OpenTelemetry\API\Common\Instrumentation\Configurator::create()
$scope = \OpenTelemetry\API\Instrumentation\Configurator::create()
->withTracerProvider($tracerProvider)
->activate();

Expand Down Expand Up @@ -59,4 +59,4 @@ Parts of this auto-instrumentation library can be configured, more options are a
|-------------------------------------|---------------|-------------------------|---------|---------------------------------------------------------------------------------|
| OTEL_PHP_DISABLED_INSTRUMENTATIONS | [] | Instrumentation name(s) | laravel | Disable one or more installed auto-instrumentations, names are comma seperated. |

Configurations can be provided as environment variables, or via `php.ini` (or a file included by `php.ini`)
Configurations can be provided as environment variables, or via `php.ini` (or a file included by `php.ini`)
2 changes: 1 addition & 1 deletion src/Instrumentation/Laravel/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"php": "^8.0",
"laravel/framework": "*",
"ext-opentelemetry": "*",
"open-telemetry/api": "^1",
"open-telemetry/api": "^1.0.0beta10",
"open-telemetry/sem-conv": "^1"
},
"require-dev": {
Expand Down
2 changes: 1 addition & 1 deletion src/Instrumentation/Laravel/src/ClientRequestWatcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
use Illuminate\Http\Client\Events\ConnectionFailed;
use Illuminate\Http\Client\Events\RequestSending;
use Illuminate\Http\Client\Events\ResponseReceived;
use OpenTelemetry\API\Common\Instrumentation\CachedInstrumentation;
use OpenTelemetry\API\Instrumentation\CachedInstrumentation;
use OpenTelemetry\API\Trace\SpanInterface;
use OpenTelemetry\API\Trace\SpanKind;
use OpenTelemetry\API\Trace\StatusCode;
Expand Down
4 changes: 2 additions & 2 deletions src/Instrumentation/Laravel/src/LaravelInstrumentation.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
use Illuminate\Foundation\Application;
use Illuminate\Foundation\Http\Kernel;
use Illuminate\Http\Request;
use OpenTelemetry\API\Common\Instrumentation\CachedInstrumentation;
use OpenTelemetry\API\Common\Instrumentation\Globals;
use OpenTelemetry\API\Globals;
use OpenTelemetry\API\Instrumentation\CachedInstrumentation;
use OpenTelemetry\API\Trace\Span;
use OpenTelemetry\API\Trace\SpanInterface;
use OpenTelemetry\API\Trace\SpanKind;
Expand Down
2 changes: 1 addition & 1 deletion src/Instrumentation/Laravel/src/QueryWatcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use Illuminate\Contracts\Foundation\Application;
use Illuminate\Database\Events\QueryExecuted;
use Illuminate\Support\Str;
use OpenTelemetry\API\Common\Instrumentation\CachedInstrumentation;
use OpenTelemetry\API\Instrumentation\CachedInstrumentation;
use OpenTelemetry\API\Trace\SpanKind;
use OpenTelemetry\SDK\Common\Time\ClockFactory;
use OpenTelemetry\SemConv\TraceAttributes;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
use Illuminate\Foundation\Http\Kernel;
use Illuminate\Http\Response;
use Illuminate\Support\Facades\Http;
use OpenTelemetry\API\Common\Instrumentation\Configurator;
use OpenTelemetry\API\Instrumentation\Configurator;
use OpenTelemetry\Context\ScopeInterface;
use OpenTelemetry\SDK\Trace\SpanExporter\InMemoryExporter;
use OpenTelemetry\SDK\Trace\SpanProcessor\SimpleSpanProcessor;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
use Illuminate\Auth\Events\Registered;
use Illuminate\Auth\Listeners\SendEmailVerificationNotification;
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
use Illuminate\Support\Facades\Event;

class EventServiceProvider extends ServiceProvider
{
Expand Down
4 changes: 2 additions & 2 deletions src/Instrumentation/PDO/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ See https://github.com/open-telemetry/opentelemetry-php#sdk-autoloading
require_once 'vendor/autoload.php';

$tracerProvider = /*create tracer provider*/;
$scope = \OpenTelemetry\API\Common\Instrumentation\Configurator::create()
$scope = \OpenTelemetry\API\Instrumentation\Configurator::create()
->withTracerProvider($tracerProvider)
->activate();

Expand Down Expand Up @@ -60,4 +60,4 @@ Parts of this auto-instrumentation library can be configured, more options are a
|-------------------------------------|---------------|-------------------------|---------|---------------------------------------------------------------------------------|
| OTEL_PHP_DISABLED_INSTRUMENTATIONS | [] | Instrumentation name(s) | pdo | Disable one or more installed auto-instrumentations, names are comma seperated. |

Configurations can be provided as environment variables, or via `php.ini` (or a file included by `php.ini`)
Configurations can be provided as environment variables, or via `php.ini` (or a file included by `php.ini`)
2 changes: 1 addition & 1 deletion src/Instrumentation/PDO/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"require": {
"php": "^8.2",
"ext-opentelemetry": "*",
"open-telemetry/api": "^1",
"open-telemetry/api": "^1.0.0beta10",
"open-telemetry/sem-conv": "^1"
},
"require-dev": {
Expand Down
2 changes: 1 addition & 1 deletion src/Instrumentation/PDO/src/PDOInstrumentation.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace OpenTelemetry\Contrib\Instrumentation\PDO;

use OpenTelemetry\API\Common\Instrumentation\CachedInstrumentation;
use OpenTelemetry\API\Instrumentation\CachedInstrumentation;
use OpenTelemetry\API\Trace\Span;
use OpenTelemetry\API\Trace\SpanBuilderInterface;
use OpenTelemetry\API\Trace\SpanKind;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@
namespace OpenTelemetry\Tests\Instrumentation\PDO\tests\Integration;

use ArrayObject;
use OpenTelemetry\API\Common\Instrumentation\Configurator;
use OpenTelemetry\API\Instrumentation\Configurator;
use OpenTelemetry\Context\ScopeInterface;
use OpenTelemetry\SDK\Trace\ImmutableSpan;
use OpenTelemetry\SDK\Trace\SpanExporter\InMemoryExporter;
use OpenTelemetry\SDK\Trace\SpanProcessor\SimpleSpanProcessor;
use OpenTelemetry\SDK\Trace\TracerProvider;
Expand Down
4 changes: 2 additions & 2 deletions src/Instrumentation/Psr15/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ To export spans, you will need to create and register a `TracerProvider` early i
require_once 'vendor/autoload.php';

$tracerProvider = /*create tracer provider*/;
$scope = \OpenTelemetry\API\Common\Instrumentation\Configurator::create()
$scope = \OpenTelemetry\API\Instrumentation\Configurator::create()
->withTracerProvider($tracerProvider)
->activate();

Expand All @@ -43,4 +43,4 @@ Parts of this auto-instrumentation library can be configured, more options are a
|-------------------------------------|---------------|-------------------------|---------|---------------------------------------------------------------------------------|
| OTEL_PHP_DISABLED_INSTRUMENTATIONS | [] | Instrumentation name(s) | psr15 | Disable one or more installed auto-instrumentations, names are comma seperated. |

Configurations can be provided as environment variables, or via `php.ini` (or a file included by `php.ini`)
Configurations can be provided as environment variables, or via `php.ini` (or a file included by `php.ini`)
2 changes: 1 addition & 1 deletion src/Instrumentation/Psr15/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"require": {
"php": "^8.0",
"ext-opentelemetry": "*",
"open-telemetry/api": "^1",
"open-telemetry/api": "^1.0.0beta10",
"open-telemetry/sem-conv": "^1",
"psr/http-server-middleware": "^1"
},
Expand Down
4 changes: 2 additions & 2 deletions src/Instrumentation/Psr15/src/Psr15Instrumentation.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

namespace OpenTelemetry\Contrib\Instrumentation\Psr15;

use OpenTelemetry\API\Common\Instrumentation\CachedInstrumentation;
use OpenTelemetry\API\Common\Instrumentation\Globals;
use OpenTelemetry\API\Globals;
use OpenTelemetry\API\Instrumentation\CachedInstrumentation;
use OpenTelemetry\API\Trace\Span;
use OpenTelemetry\API\Trace\SpanInterface;
use OpenTelemetry\API\Trace\SpanKind;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
use Nyholm\Psr7\Response;
use Nyholm\Psr7\ServerRequest;
use Nyholm\Psr7\Uri;
use OpenTelemetry\API\Common\Instrumentation\Configurator;
use OpenTelemetry\API\Instrumentation\Configurator;
use OpenTelemetry\API\Trace\Propagation\TraceContextPropagator;
use OpenTelemetry\API\Trace\Span;
use OpenTelemetry\API\Trace\SpanInterface;
Expand Down
4 changes: 2 additions & 2 deletions src/Instrumentation/Psr18/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ If you are not using SDK autoloading, you will need to create and register a `Tr
require_once 'vendor/autoload.php';

$tracerProvider = /*create tracer provider*/;
$scope = \OpenTelemetry\API\Common\Instrumentation\Configurator::create()
$scope = \OpenTelemetry\API\Instrumentation\Configurator::create()
->withTracerProvider($tracerProvider)
->activate();

Expand All @@ -49,4 +49,4 @@ Parts of this auto-instrumentation library can be configured, more options are a
|-------------------------------------|---------------|-------------------------|---------|---------------------------------------------------------------------------------|
| OTEL_PHP_DISABLED_INSTRUMENTATIONS | [] | Instrumentation name(s) | psr18 | Disable one or more installed auto-instrumentations, names are comma seperated. |

Configurations can be provided as environment variables, or via `php.ini` (or a file included by `php.ini`)
Configurations can be provided as environment variables, or via `php.ini` (or a file included by `php.ini`)
2 changes: 1 addition & 1 deletion src/Instrumentation/Psr18/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"require": {
"php": "^8.0",
"ext-opentelemetry": "*",
"open-telemetry/api": "^1",
"open-telemetry/api": "^1.0.0beta10",
"open-telemetry/sem-conv": "^1",
"psr/http-client": "^1"
},
Expand Down
6 changes: 3 additions & 3 deletions src/Instrumentation/Psr18/src/Psr18Instrumentation.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
namespace OpenTelemetry\Contrib\Instrumentation\Psr18;

use function get_cfg_var;
use OpenTelemetry\API\Common\Instrumentation;
use OpenTelemetry\API\Common\Instrumentation\CachedInstrumentation;
use OpenTelemetry\API\Globals;
use OpenTelemetry\API\Instrumentation\CachedInstrumentation;
use OpenTelemetry\API\Trace\Span;
use OpenTelemetry\API\Trace\SpanKind;
use OpenTelemetry\API\Trace\StatusCode;
Expand Down Expand Up @@ -40,7 +40,7 @@ public static function register(): void
return null;
}

$propagator = Instrumentation\Globals::propagator();
$propagator = Globals::propagator();
$parentContext = Context::getCurrent();

/** @psalm-suppress ArgumentTypeCoercion */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use ArrayObject;
use Nyholm\Psr7\Request;
use Nyholm\Psr7\Response;
use OpenTelemetry\API\Common\Instrumentation\Configurator;
use OpenTelemetry\API\Instrumentation\Configurator;
use OpenTelemetry\API\Trace\Propagation\TraceContextPropagator;
use OpenTelemetry\Context\ScopeInterface;
use OpenTelemetry\SDK\Trace\ImmutableSpan;
Expand Down
4 changes: 2 additions & 2 deletions src/Instrumentation/Slim/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ See https://github.com/open-telemetry/opentelemetry-php#sdk-autoloading
require_once 'vendor/autoload.php';

$tracerProvider = /*create tracer provider*/;
$scope = \OpenTelemetry\API\Common\Instrumentation\Configurator::create()
$scope = \OpenTelemetry\API\Instrumentation\Configurator::create()
->withTracerProvider($tracerProvider)
->activate();

Expand All @@ -54,4 +54,4 @@ Parts of this auto-instrumentation library can be configured, more options are a
|-------------------------------------|---------------|-------------------------|---------|---------------------------------------------------------------------------------|
| OTEL_PHP_DISABLED_INSTRUMENTATIONS | [] | Instrumentation name(s) | slim | Disable one or more installed auto-instrumentations, names are comma seperated. |

Configurations can be provided as environment variables, or via `php.ini` (or a file included by `php.ini`)
Configurations can be provided as environment variables, or via `php.ini` (or a file included by `php.ini`)
Loading

0 comments on commit e866749

Please sign in to comment.