Skip to content
Merged
Show file tree
Hide file tree
Changes from 33 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
2c9e38b
update auto-instrumentation packages to SemConv 1.30.0
brettmc Feb 6, 2025
378015d
Curl semconv 1.30
brettmc Feb 6, 2025
d431d52
amqp
brettmc Feb 6, 2025
85c1a2d
rdkafka
brettmc Feb 6, 2025
9380eab
guzzle
brettmc Feb 6, 2025
f47fdf0
HttpAsyncClient
brettmc Feb 6, 2025
5a29022
io
brettmc Feb 6, 2025
f99a06f
laravel
brettmc Feb 6, 2025
9d29682
mongodb
brettmc Feb 6, 2025
8353a5b
mysqli
brettmc Feb 6, 2025
e090bcb
openaiphp
brettmc Feb 6, 2025
a36267c
pdo
brettmc Feb 6, 2025
a83ff61
psr3
brettmc Feb 6, 2025
9b014a2
psr6
brettmc Feb 6, 2025
d77b8cd
psr14
brettmc Feb 6, 2025
f561a33
psr15
brettmc Feb 6, 2025
df0e60d
psr16
brettmc Feb 6, 2025
8345f3a
psr18
brettmc Feb 6, 2025
104cf0b
slim
brettmc Feb 6, 2025
d7891e7
symfony
brettmc Feb 6, 2025
fbd27b2
wordpress
brettmc Feb 6, 2025
f3e7009
yii
brettmc Feb 6, 2025
d8de072
symfony
brettmc Feb 6, 2025
baaa125
logs
brettmc Feb 6, 2025
d0206c9
hard-code schema url for 8.0-supporting packages
brettmc Feb 6, 2025
34c5896
no-plugins for composer make targets
brettmc Feb 6, 2025
09ed016
drop 7.4 testing
brettmc Feb 6, 2025
73b1952
fixing build errors
brettmc Feb 6, 2025
01ce182
fixing more broken things
brettmc Feb 6, 2025
32b35cd
laravel lint
brettmc Feb 6, 2025
a174a30
fix laravel phan deprecation error
brettmc Feb 6, 2025
fea2bac
skip failing cake test on 8.0
brettmc Feb 6, 2025
3d4232a
fix message span names
brettmc Feb 10, 2025
223700d
flip messaging span names
brettmc Feb 11, 2025
402dc53
more messaging switch + fixed tests
brettmc Feb 11, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 5 additions & 45 deletions .github/workflows/php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
strategy:
fail-fast: false
matrix:
php-version: ['7.4', '8.0', '8.1', '8.2', '8.3']
php-version: ['8.0', '8.1', '8.2', '8.3']
# Sorted alphabetically to ease finding the desired run in the GitHub Workflow UI.
project: [
'Aws',
Expand Down Expand Up @@ -55,34 +55,6 @@ jobs:
'Symfony',
]
exclude:
- project: 'Instrumentation/Guzzle'
php-version: 7.4
- project: 'Instrumentation/HttpAsyncClient'
php-version: 7.4
- project: 'Instrumentation/Slim'
php-version: 7.4
- project: 'Instrumentation/Psr3'
php-version: 7.4
- project: 'Instrumentation/Psr6'
php-version: 7.4
- project: 'Instrumentation/Psr14'
php-version: 7.4
- project: 'Instrumentation/Psr15'
php-version: 7.4
- project: 'Instrumentation/Psr16'
php-version: 7.4
- project: 'Instrumentation/Psr18'
php-version: 7.4
- project: 'Instrumentation/IO'
php-version: 7.4
- project: 'Instrumentation/Symfony'
php-version: 7.4
- project: 'Instrumentation/Laravel'
php-version: 7.4
- project: 'Instrumentation/CodeIgniter'
php-version: 7.4
- project: 'Instrumentation/Yii'
php-version: 7.4
- project: 'Instrumentation/IO'
php-version: 8.0
- project: 'Instrumentation/IO'
Expand All @@ -99,14 +71,12 @@ jobs:
php-version: 8.0
- project: 'Instrumentation/MySqli'
php-version: 8.1
- project: 'Instrumentation/PDO'
php-version: 7.4
- project: 'Instrumentation/PDO'
php-version: 8.0
- project: 'Instrumentation/PDO'
php-version: 8.1
- project: 'Instrumentation/ExtAmqp'
php-version: 7.4
- project: 'Instrumentation/Psr3'
php-version: 8.0
- project: 'Instrumentation/ExtAmqp'
php-version: 8.0
- project: 'Instrumentation/ExtAmqp'
Expand All @@ -117,22 +87,12 @@ jobs:
php-version: 8.0
- project: 'Instrumentation/ExtRdKafka'
php-version: 8.1
- project: 'Instrumentation/OpenAIPHP'
php-version: 7.4
- project: 'Instrumentation/OpenAIPHP'
php-version: 8.0
- project: 'Instrumentation/CakePHP'
php-version: 7.4
- project: 'Propagation/ServerTiming'
php-version: 7.4
- project: 'ResourceDetectors/Container'
php-version: 7.4
- project: 'Sampler/RuleBased'
php-version: 7.4
- project: 'Logs/Monolog'
php-version: 8.0
- project: 'Sampler/RuleBased'
php-version: 8.0
- project: 'Symfony'
php-version: 7.4
- project: 'Symfony'
php-version: 8.0
steps:
Expand Down
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ build: ## Build image
install: ## Install dependencies
$(DC_RUN_PHP) env XDEBUG_MODE=off composer install
update: ## Update dependencies
$(DC_RUN_PHP) env XDEBUG_MODE=off composer update
$(DC_RUN_PHP) env XDEBUG_MODE=off composer update --no-plugins
update-lowest: ## Update dependencies to lowest supported versions
$(DC_RUN_PHP) env XDEBUG_MODE=off composer update --prefer-lowest
$(DC_RUN_PHP) env XDEBUG_MODE=off composer update --no-plugins --prefer-lowest
test: ## Run all tests
$(DC_RUN_PHP) env XDEBUG_MODE=off vendor/bin/phpunit --testdox --colors=always
test-unit: ## Run unit tests
Expand All @@ -39,7 +39,7 @@ psalm-info: ## Run psalm with info
phpstan: ## Run phpstan
$(DC_RUN_PHP) env XDEBUG_MODE=off vendor/bin/phpstan analyse --memory-limit=256M
validate: ## Validate composer file
$(DC_RUN_PHP) env XDEBUG_MODE=off composer validate
$(DC_RUN_PHP) env XDEBUG_MODE=off composer validate --no-plugins
packages-composer: ## Validate all composer packages
$(DC_RUN) php env XDEBUG_MODE=off vendor/bin/otel packages:composer:validate
bash: ## Bash shell
Expand Down
2 changes: 1 addition & 1 deletion src/Instrumentation/CakePHP/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"ext-opentelemetry": "*",
"cakephp/cakephp": "^4 || ^5",
"open-telemetry/api": "^1.0",
"open-telemetry/sem-conv": "^1.24"
"open-telemetry/sem-conv": "^1.30"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^3",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public static function register(): void
$instrumentation = new CachedInstrumentation(
'io.opentelemetry.contrib.php.cakephp',
null,
'https://opentelemetry.io/schemas/1.24.0'
'https://opentelemetry.io/schemas/1.30.0',
);
Server::hook($instrumentation);
Controller::hook($instrumentation);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ public function instrument(): void
$builder = $this->instrumentation
->tracer()
->spanBuilder(sprintf('Command %s', $command->getName() ?: 'unknown'))
->setAttribute(TraceAttributes::CODE_FUNCTION, $function)
->setAttribute(TraceAttributes::CODE_FUNCTION_NAME, $function)
->setAttribute(TraceAttributes::CODE_NAMESPACE, $class)
->setAttribute(TraceAttributes::CODE_FILEPATH, $filename)
->setAttribute(TraceAttributes::CODE_LINENO, $lineno);
->setAttribute(TraceAttributes::CODE_LINE_NUMBER, $lineno);

$parent = Context::getCurrent();
$span = $builder->startSpan();
Expand All @@ -52,9 +52,7 @@ public function instrument(): void
$span = Span::fromContext($scope->context());

if ($exception) {
$span->recordException($exception, [
TraceAttributes::EXCEPTION_ESCAPED => true,
]);
$span->recordException($exception);
$span->setStatus(StatusCode::STATUS_ERROR, $exception->getMessage());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public function instrument(): void
$scope->detach();
$span = \OpenTelemetry\API\Trace\Span::fromContext($scope->context());
if ($exception) {
$span->recordException($exception, [TraceAttributes::EXCEPTION_ESCAPED => true]);
$span->recordException($exception);
$span->setStatus(StatusCode::STATUS_ERROR, $exception->getMessage());
}
$response = $app->getResponse();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public function instrument(): void
$span->setAttribute(TraceAttributes::HTTP_ROUTE, $route);
}
if ($exception) {
$span->recordException($exception, [TraceAttributes::EXCEPTION_ESCAPED => true]);
$span->recordException($exception);
$span->setStatus(StatusCode::STATUS_ERROR, $exception->getMessage());
}
if ($response) {
Expand Down
4 changes: 2 additions & 2 deletions src/Instrumentation/CakePHP/src/Hooks/CakeHookTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@ protected function buildSpan(?ServerRequestInterface $request, string $class, st
: sprintf('%s', $request?->getMethod() ?? 'unknown')
)
->setSpanKind(SpanKind::KIND_SERVER)
->setAttribute(TraceAttributes::CODE_FUNCTION, $function)
->setAttribute(TraceAttributes::CODE_FUNCTION_NAME, $function)
->setAttribute(TraceAttributes::CODE_NAMESPACE, $class)
->setAttribute(TraceAttributes::CODE_FILEPATH, $filename)
->setAttribute(TraceAttributes::CODE_LINENO, $lineno);
->setAttribute(TraceAttributes::CODE_LINE_NUMBER, $lineno);
$parent = Context::getCurrent();
if (!$root && $request) {
$this->isRoot = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public function test_index(): void
$this->assertSame(SpanKind::KIND_SERVER, $serverSpan->getKind());
$this->assertGreaterThan(0, $serverSpan->getAttributes()->count());
$attributes = $serverSpan->getAttributes()->toArray();
$this->assertSame('run', $attributes['code.function']);
$this->assertSame('run', $attributes['code.function.name']);
$this->assertSame('GET', $attributes['http.request.method']);
$this->assertSame(200, $attributes['http.response.status_code']);
$this->assertSame(self::TRACE_ID, $serverSpan->getParentContext()->getTraceId());
Expand All @@ -58,7 +58,7 @@ public function test_index(): void
$this->assertSame(SpanKind::KIND_INTERNAL, $controllerSpan->getKind());
$this->assertGreaterThan(0, $controllerSpan->getAttributes()->count());
$attributes = $controllerSpan->getAttributes()->toArray();
$this->assertSame('invokeAction', $attributes['code.function']);
$this->assertSame('invokeAction', $attributes['code.function.name']);
$this->assertSame($serverSpan->getTraceId(), $controllerSpan->getParentContext()->getTraceId());
$this->assertSame($serverSpan->getSpanId(), $controllerSpan->getParentContext()->getSpanId());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ class CommandTest extends TestCase

public function test_command_tracing(): void
{
if (PHP_VERSION_ID < 80100) {
$this->markTestSkipped();
}
$this->assertCount(0, $this->storage);

$this->exec('dummy');
Expand Down
2 changes: 1 addition & 1 deletion src/Instrumentation/CodeIgniter/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"ext-opentelemetry": "*",
"codeigniter4/framework": "^4.3",
"open-telemetry/api": "^1.0",
"open-telemetry/sem-conv": "^1.24"
"open-telemetry/sem-conv": "^1.30"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^3.50",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public static function register(): void
$instrumentation = new CachedInstrumentation(
'io.opentelemetry.contrib.php.codeigniter',
null,
'https://opentelemetry.io/schemas/1.24.0'
'https://opentelemetry.io/schemas/1.30.0',
);

// The method that creates request/response/controller objects is in the same class as the method
Expand Down Expand Up @@ -60,10 +60,10 @@ public static function register(): void
/** @phan-suppress-next-line PhanDeprecatedFunction */
->spanBuilder(\sprintf('%s', $request?->getMethod() ?? 'unknown'))
->setSpanKind(SpanKind::KIND_SERVER)
->setAttribute(TraceAttributes::CODE_FUNCTION, $function)
->setAttribute(TraceAttributes::CODE_FUNCTION_NAME, $function)
->setAttribute(TraceAttributes::CODE_NAMESPACE, $class)
->setAttribute(TraceAttributes::CODE_FILEPATH, $filename)
->setAttribute(TraceAttributes::CODE_LINENO, $lineno);
->setAttribute(TraceAttributes::CODE_LINE_NUMBER, $lineno);

$parent = Context::getCurrent();

Expand Down Expand Up @@ -146,7 +146,7 @@ public static function register(): void
}

if ($exception) {
$span->recordException($exception, [TraceAttributes::EXCEPTION_ESCAPED => true]);
$span->recordException($exception);
$span->setStatus(StatusCode::STATUS_ERROR, $exception->getMessage());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,5 @@ public function test_exception()
$this->assertEquals('Exception', $eventAttributes->get('exception.type'));
$this->assertEquals('Threw', $eventAttributes->get('exception.message'));
$this->assertNotNull($eventAttributes->get('exception.stacktrace'));
$this->assertTrue($eventAttributes->get('exception.escaped'));
}
}
Loading
Loading