Skip to content

Commit c53a6db

Browse files
Merge remote-tracking branch 'upstream/main' into spi/laravel
2 parents cf6deaf + c06f8c6 commit c53a6db

File tree

64 files changed

+2134
-46
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+2134
-46
lines changed

.github/workflows/php.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ jobs:
4747
'Propagation/TraceResponse',
4848
'ResourceDetectors/Azure',
4949
'ResourceDetectors/Container',
50+
'Sampler/RuleBased',
5051
'Shims/OpenTracing',
5152
'Symfony'
5253
]
@@ -111,6 +112,10 @@ jobs:
111112
php-version: 7.4
112113
- project: 'ResourceDetectors/Container'
113114
php-version: 7.4
115+
- project: 'Sampler/RuleBased'
116+
php-version: 7.4
117+
- project: 'Sampler/RuleBased'
118+
php-version: 8.0
114119
steps:
115120
- uses: actions/checkout@v4
116121

.gitsplit.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ splits:
6868
target: "https://${GH_TOKEN}@github.com/opentelemetry-php/contrib-detector-azure.git"
6969
- prefix: "src/ResourceDetectors/Container"
7070
target: "https://${GH_TOKEN}@github.com/opentelemetry-php/contrib-detector-container.git"
71+
- prefix: "src/Sampler/RuleBased"
72+
target: "https://${GH_TOKEN}@github.com/opentelemetry-php/contrib-sampler-rulebased.git"
7173
- prefix: "src/Shims/OpenTracing"
7274
target: "https://${GH_TOKEN}@github.com/opentelemetry-php/contrib-shim-opentracing.git"
7375
# List of references to split (defined as regexp)

src/Context/Swoole/src/SwooleContextHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public function switchToActiveCoroutine(): void
4141
public function splitOffChildCoroutines(): void
4242
{
4343
$pcid = Coroutine::getCid();
44-
foreach (Coroutine::listCoroutines() as $cid) {
44+
foreach (method_exists(Coroutine::class, 'list') ? Coroutine::list() : Coroutine::listCoroutines() as $cid) {
4545
if ($pcid === Coroutine::getPcid($cid) && !$this->isForked($cid)) {
4646
$this->forkCoroutine($cid);
4747
}

src/Instrumentation/CakePHP/src/CakePHPInstrumentation.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
use OpenTelemetry\Contrib\Instrumentation\CakePHP\Hooks\Cake\Command\Command;
99
use OpenTelemetry\Contrib\Instrumentation\CakePHP\Hooks\Cake\Controller\Controller;
1010
use OpenTelemetry\Contrib\Instrumentation\CakePHP\Hooks\Cake\Http\Server;
11-
use OpenTelemetry\SemConv\TraceAttributes;
1211

1312
class CakePHPInstrumentation
1413
{
@@ -25,4 +24,4 @@ public static function register(): void
2524
Controller::hook($instrumentation);
2625
Command::hook($instrumentation);
2726
}
28-
}
27+
}

src/Instrumentation/CakePHP/src/Hooks/Cake/Command/Command.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
declare(strict_types=1);
44

5-
namespace OpenTelemetry\Contrib\Instrumentation\CakePHP\Hooks\Cake\Command;
5+
namespace OpenTelemetry\Contrib\Instrumentation\CakePHP\Hooks\Cake\Command;
66

77
use OpenTelemetry\API\Trace\Span;
88
use OpenTelemetry\API\Trace\StatusCode;

src/Instrumentation/CakePHP/src/Hooks/Cake/Http/Server.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,11 @@
66

77
use Cake\Routing\Exception\MissingRouteException;
88
use Cake\Routing\Router;
9-
use OpenTelemetry\API\Trace\SpanInterface;
109
use OpenTelemetry\API\Trace\StatusCode;
1110
use OpenTelemetry\Context\Context;
1211
use OpenTelemetry\Contrib\Instrumentation\CakePHP\Hooks\CakeHook;
1312
use OpenTelemetry\Contrib\Instrumentation\CakePHP\Hooks\CakeHookTrait;
1413
use function OpenTelemetry\Instrumentation\hook;
15-
use OpenTelemetry\SDK\Common\Time\ClockInterface;
1614
use OpenTelemetry\SemConv\TraceAttributes;
1715
use Psr\Http\Message\ResponseInterface;
1816
use Psr\Http\Message\ServerRequestInterface;
@@ -47,7 +45,7 @@ public function instrument(): void
4745
$route = $this->getRouteTemplate($request);
4846
$span = \OpenTelemetry\API\Trace\Span::fromContext($scope->context());
4947

50-
if($route && $this->isRoot()) {
48+
if ($route && $this->isRoot()) {
5149
$span->setAttribute(TraceAttributes::HTTP_ROUTE, $route);
5250
}
5351
if ($exception) {
@@ -83,4 +81,4 @@ private function getRouteTemplate($request): string|null
8381
return null;
8482
}
8583
}
86-
}
84+
}

src/Instrumentation/CakePHP/src/Hooks/CakeHookTrait.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ public static function hook(CachedInstrumentation $instrumentation): CakeHook
4444
* @param string|null $filename
4545
* @param int|null $lineno
4646
* @return mixed
47+
* @psalm-suppress ArgumentTypeCoercion
4748
*/
4849
protected function buildSpan(?ServerRequestInterface $request, string $class, string $function, ?string $filename, ?int $lineno): mixed
4950
{

src/Instrumentation/CakePHP/tests/Integration/App/config/app.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,9 @@
173173
'skipLog' => [],
174174
'log' => true,
175175
'trace' => true,
176-
'ignoredDeprecationPaths' => [],
176+
'ignoredDeprecationPaths' => [
177+
'/src/I18n/I18n.php',
178+
],
177179
],
178180

179181
/*

src/Instrumentation/CakePHP/tests/Integration/CakePHPInstrumentationTest.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
use Cake\TestSuite\IntegrationTestTrait;
88
use OpenTelemetry\API\Trace\SpanKind;
99
use OpenTelemetry\API\Trace\StatusCode;
10-
use OpenTelemetry\SDK\Metrics\Data\Histogram;
1110
use OpenTelemetry\SDK\Trace\ImmutableSpan;
1211

1312
/**
@@ -129,4 +128,4 @@ public function test_response_code_gte_400(): void
129128
$attributes = $span->getAttributes()->toArray();
130129
$this->assertSame(400, $attributes['http.response.status_code']);
131130
}
132-
}
131+
}

src/Instrumentation/CakePHP/tests/Integration/TestCase.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
use OpenTelemetry\API\Instrumentation\Configurator;
99
use OpenTelemetry\API\Trace\Propagation\TraceContextPropagator;
1010
use OpenTelemetry\Context\ScopeInterface;
11-
use OpenTelemetry\SDK\Metrics\MeterProvider;
12-
use OpenTelemetry\SDK\Metrics\MetricReader\ExportingReader;
1311
use OpenTelemetry\SDK\Trace\ImmutableSpan;
1412
use OpenTelemetry\SDK\Trace\SpanExporter\InMemoryExporter;
1513
use OpenTelemetry\SDK\Trace\SpanProcessor\SimpleSpanProcessor;
@@ -45,4 +43,4 @@ public function tearDown(): void
4543

4644
$this->scope->detach();
4745
}
48-
}
46+
}

0 commit comments

Comments
 (0)