Skip to content

Commit 5ac16d4

Browse files
committed
Merge remote-tracking branch 'upstream/main' into pass-proper-client-name-and-region
2 parents d175aff + c06b139 commit 5ac16d4

File tree

144 files changed

+1151
-258
lines changed

Some content is hidden

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

144 files changed

+1151
-258
lines changed

.github/workflows/fossa.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: FOSSA scanning
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
permissions:
9+
contents: read
10+
11+
jobs:
12+
fossa:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
16+
17+
- uses: fossas/fossa-action@93a52ecf7c3ac7eb40f5de77fd69b1a19524de94 # v1.5.0
18+
with:
19+
api-key: ${{secrets.FOSSA_API_KEY}}
20+
team: OpenTelemetry

.github/workflows/php.yml

Lines changed: 12 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,15 @@ 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',
2424
'Context/Swoole',
2525
'Instrumentation/CakePHP',
2626
'Instrumentation/CodeIgniter',
2727
'Instrumentation/Curl',
28+
'Instrumentation/Doctrine',
2829
'Instrumentation/ExtAmqp',
2930
'Instrumentation/ExtRdKafka',
3031
'Instrumentation/Guzzle',
@@ -55,46 +56,21 @@ jobs:
5556
'Symfony',
5657
]
5758
exclude:
58-
- project: 'Instrumentation/IO'
59-
php-version: 8.0
60-
- project: 'Instrumentation/IO'
61-
php-version: 8.1
62-
- project: 'Instrumentation/Curl'
63-
php-version: 7.4
64-
- project: 'Instrumentation/Curl'
65-
php-version: 8.0
59+
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
72-
- project: 'Instrumentation/MySqli'
62+
- project: 'Instrumentation/Doctrine'
7363
php-version: 8.1
74-
- project: 'Instrumentation/PDO'
75-
php-version: 8.0
76-
- project: 'Instrumentation/PDO'
77-
php-version: 8.1
78-
- project: 'Instrumentation/Psr3'
79-
php-version: 8.0
80-
- project: 'Instrumentation/ExtAmqp'
81-
php-version: 8.0
8264
- project: 'Instrumentation/ExtAmqp'
8365
php-version: 8.1
8466
- project: 'Instrumentation/ExtRdKafka'
85-
php-version: 7.4
86-
- project: 'Instrumentation/ExtRdKafka'
87-
php-version: 8.0
88-
- project: 'Instrumentation/ExtRdKafka'
8967
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
68+
- project: 'Instrumentation/IO'
69+
php-version: 8.1
70+
- project: 'Instrumentation/MySqli'
71+
php-version: 8.1
72+
- project: 'Instrumentation/PDO'
73+
php-version: 8.1
9874
steps:
9975
- uses: actions/checkout@v4
10076

@@ -130,7 +106,7 @@ jobs:
130106

131107
- name: Check Style
132108
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
109+
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
134110

135111
- name: Run Phan
136112
working-directory: src/${{ matrix.project }}
@@ -179,7 +155,7 @@ jobs:
179155
- name: Code Coverage
180156
uses: codecov/codecov-action@v4
181157
# only generate coverage against the latest PHP version
182-
if: ${{ matrix.php-version == '8.3' }}
158+
if: ${{ matrix.php-version == '8.4' }}
183159
with:
184160
token: ${{ secrets.CODECOV_TOKEN }}
185161
directory: src/${{ matrix.project }}

.gitsplit.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ splits:
5858
target: "https://${GH_TOKEN}@github.com/opentelemetry-php/contrib-auto-cakephp.git"
5959
- prefix: "src/Instrumentation/Yii"
6060
target: "https://${GH_TOKEN}@github.com/opentelemetry-php/contrib-auto-yii.git"
61+
- prefix: "src/Instrumentation/Doctrine"
62+
target: "https://${GH_TOKEN}@github.com/opentelemetry-php/contrib-auto-doctrine.git"
6163
- prefix: "src/Context/Swoole"
6264
target: "https://${GH_TOKEN}@github.com/opentelemetry-php/context-swoole.git"
6365
- prefix: "src/AutoInstrumentationInstaller"

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
@@ -75,6 +75,7 @@ public function getTracer(): TracerInterface
7575
return $this->tracerProvider->getTracer('io.opentelemetry.contrib.php');
7676
}
7777

78+
/** @psalm-api */
7879
public function instrumentClients($clientsArray): void
7980
{
8081
$this->clients = $clientsArray;
@@ -92,7 +93,7 @@ public function activate(): bool
9293
$clientName = $client->getApi()->getServiceName();
9394
$region = $client->getRegion();
9495

95-
$client->getHandlerList()->prependInit(Middleware::tap(function ($cmd, $req) use ($clientName, $region, $hash) {
96+
$client->getHandlerList()->prependInit(Middleware::tap(function ($cmd, $_req) use ($clientName, $region, $hash) {
9697
$tracer = $this->getTracer();
9798
$propagator = $this->getPropagator();
9899

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
}

0 commit comments

Comments
 (0)