Skip to content

Commit 261c2d0

Browse files
authored
Drop support for PHP 7.4 and 8.0, introduce support for PHP 8.4, fix semconv deprecations (#315)
* Fixed a bit of warnings and deprecations * Dropped support for PHP 7.4 and 8.0. Introduced support for PHP 8.4 * Set revision psalm to 6.4.0, more suppressions * Curl instrumentation fix * updated packages generating deprecated warnings
1 parent 298bc5b commit 261c2d0

File tree

131 files changed

+406
-252
lines changed

Some content is hidden

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

131 files changed

+406
-252
lines changed

.github/workflows/php.yml

Lines changed: 3 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
strategy:
1818
fail-fast: false
1919
matrix:
20-
php-version: ['8.0', '8.1', '8.2', '8.3']
20+
php-version: ['8.1', '8.2', '8.3', '8.4']
2121
# Sorted alphabetically to ease finding the desired run in the GitHub Workflow UI.
2222
project: [
2323
'Aws',
@@ -55,46 +55,18 @@ jobs:
5555
'Symfony',
5656
]
5757
exclude:
58-
- project: 'Instrumentation/IO'
59-
php-version: 8.0
6058
- project: 'Instrumentation/IO'
6159
php-version: 8.1
62-
- project: 'Instrumentation/Curl'
63-
php-version: 7.4
64-
- project: 'Instrumentation/Curl'
65-
php-version: 8.0
6660
- project: 'Instrumentation/Curl'
6761
php-version: 8.1
68-
- project: 'Instrumentation/MySqli'
69-
php-version: 7.4
70-
- project: 'Instrumentation/MySqli'
71-
php-version: 8.0
7262
- project: 'Instrumentation/MySqli'
7363
php-version: 8.1
74-
- project: 'Instrumentation/PDO'
75-
php-version: 8.0
7664
- project: 'Instrumentation/PDO'
7765
php-version: 8.1
78-
- project: 'Instrumentation/Psr3'
79-
php-version: 8.0
80-
- project: 'Instrumentation/ExtAmqp'
81-
php-version: 8.0
8266
- project: 'Instrumentation/ExtAmqp'
8367
php-version: 8.1
84-
- project: 'Instrumentation/ExtRdKafka'
85-
php-version: 7.4
86-
- project: 'Instrumentation/ExtRdKafka'
87-
php-version: 8.0
8868
- project: 'Instrumentation/ExtRdKafka'
8969
php-version: 8.1
90-
- project: 'Instrumentation/OpenAIPHP'
91-
php-version: 8.0
92-
- project: 'Logs/Monolog'
93-
php-version: 8.0
94-
- project: 'Sampler/RuleBased'
95-
php-version: 8.0
96-
- project: 'Symfony'
97-
php-version: 8.0
9870
steps:
9971
- uses: actions/checkout@v4
10072

@@ -130,7 +102,7 @@ jobs:
130102

131103
- name: Check Style
132104
working-directory: src/${{ matrix.project }}
133-
run: vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.php -v --dry-run --stop-on-violation --using-cache=no -vvv
105+
run: PHP_CS_FIXER_IGNORE_ENV=1 vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.php -v --dry-run --stop-on-violation --using-cache=no -vvv
134106

135107
- name: Run Phan
136108
working-directory: src/${{ matrix.project }}
@@ -179,7 +151,7 @@ jobs:
179151
- name: Code Coverage
180152
uses: codecov/codecov-action@v4
181153
# only generate coverage against the latest PHP version
182-
if: ${{ matrix.php-version == '8.3' }}
154+
if: ${{ matrix.php-version == '8.4' }}
183155
with:
184156
token: ${{ secrets.CODECOV_TOKEN }}
185157
directory: src/${{ matrix.project }}

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ packages-composer: ## Validate all composer packages
4545
bash: ## Bash shell
4646
$(DC_RUN_PHP) bash
4747
style: ## Run php-cs-fixer
48-
$(DC_RUN_PHP) env XDEBUG_MODE=off vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.php --using-cache=no -vvv
48+
$(DC_RUN_PHP) env XDEBUG_MODE=off PHP_CS_FIXER_IGNORE_ENV=1 vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.php --using-cache=no -vvv
4949
split: ## git-split dry run
5050
${DOCKER_COMPOSE} -f docker/gitsplit/docker-compose.yaml --env-file ./.env up
5151
FORCE:

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"minimum-stability": "dev",
77
"prefer-stable": true,
88
"require": {
9-
"php": "^7.4 || ^8.0",
9+
"php": "^8.1",
1010
"ext-json": "*"
1111
},
1212
"require-dev": {

docker/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
ARG PHP_VERSION=8.0
1+
ARG PHP_VERSION=8.1
22
FROM ghcr.io/open-telemetry/opentelemetry-php/opentelemetry-php-base:${PHP_VERSION}
33

44
USER root

src/Aws/composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"minimum-stability": "dev",
1414
"prefer-stable": true,
1515
"require": {
16-
"php": "^7.4 || ^8.0",
16+
"php": "^8.1",
1717
"open-telemetry/api": "^1.0",
1818
"open-telemetry/sdk": "^1.0",
1919
"aws/aws-sdk-php": "^3.232"
@@ -28,8 +28,8 @@
2828
"phpstan/phpstan": "^1.4",
2929
"phpstan/phpstan-phpunit": "^1.0",
3030
"phpunit/phpunit": "~9",
31-
"psalm/plugin-phpunit": "^0.18.4",
32-
"vimeo/psalm": "^5.0"
31+
"psalm/plugin-phpunit": "^0.19.2",
32+
"vimeo/psalm": "6.4.0"
3333
},
3434
"autoload": {
3535
"psr-4": {

src/Aws/src/AwsSdkInstrumentation.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ public function getTracer(): TracerInterface
7878
return $this->tracerProvider->getTracer('io.opentelemetry.contrib.php');
7979
}
8080

81+
/** @psalm-api */
8182
public function instrumentClients($clientsArray) : void
8283
{
8384
$this->clients = $clientsArray;
@@ -87,7 +88,7 @@ public function instrumentClients($clientsArray) : void
8788
public function activate(): bool
8889
{
8990
try {
90-
$middleware = Middleware::tap(function ($cmd, $req) {
91+
$middleware = Middleware::tap(function ($cmd, $_req) {
9192
$tracer = $this->getTracer();
9293
$propagator = $this->getPropagator();
9394

src/Aws/src/Ecs/Detector.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ private function getMetadataEndpointV4Resource(): ResourceInfo
175175

176176
$containerMetadata = json_decode($containerResponse->getBody()->getContents(), true);
177177
$taskMetadata = json_decode($taskResponse->getBody()->getContents(), true);
178-
178+
179179
$launchType = isset($taskMetadata['LaunchType']) ? strtolower($taskMetadata['LaunchType']) : null;
180180
$taskFamily = isset($taskMetadata['Family']) ? $taskMetadata['Family'] : null;
181181
$taskRevision = isset($taskMetadata['Revision']) ? $taskMetadata['Revision'] : null;
@@ -208,7 +208,7 @@ private function getMetadataEndpointV4Resource(): ResourceInfo
208208
}
209209

210210
$containerArn = isset($containerMetadata['ContainerARN']) ? $containerMetadata['ContainerARN'] : null;
211-
211+
212212
$logResource = ResourceInfoFactory::emptyResource();
213213
if (isset($containerMetadata['LogOptions']) && isset($containerMetadata['LogDriver']) && $containerMetadata['LogDriver'] === 'awslogs') {
214214
$logOptions = $containerMetadata['LogOptions'];
@@ -218,7 +218,7 @@ private function getMetadataEndpointV4Resource(): ResourceInfo
218218
$logsGroupArns = [];
219219
$logsStreamArns = [];
220220
if (isset($containerMetadata['ContainerARN']) && preg_match('/arn:aws:ecs:([^:]+):([^:]+):.*/', $containerMetadata['ContainerARN'], $matches)) {
221-
[$arn, $awsRegion, $awsAccount] = $matches;
221+
[$_arn, $awsRegion, $awsAccount] = $matches;
222222

223223
$logsGroupArns = ['arn:aws:logs:' . $awsRegion . ':' . $awsAccount . ':log-group:' . $logsGroupName];
224224
$logsStreamArns = ['arn:aws:logs:' . $awsRegion . ':' . $awsAccount . ':log-group:' . $logsGroupName . ':log-stream:' . $logsStreamName];

src/Aws/src/Eks/DataProvider.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public function getK8sHeader(): ?string
2828
return null;
2929
}
3030

31-
return 'Bearer' . file_get_contents($this->k8sTokenPath);
31+
return 'Bearer' . (file_get_contents($this->k8sTokenPath) ?: '');
3232
}
3333

3434
// Check if there exists a k8s certification file
@@ -43,6 +43,6 @@ public function getCgroupData(): ?array
4343
return null;
4444
}
4545

46-
return file($this->cGroupPath, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
46+
return file($this->cGroupPath, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES) ?: null;
4747
}
4848
}

src/Aws/src/Xray/IdGenerator.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
/*
34
* Copyright The OpenTelemetry Authors
45
*

src/Aws/src/Xray/Propagator.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
/*
34
* Copyright The OpenTelemetry Authors
45
*

0 commit comments

Comments
 (0)