From 39cc549f04f7bcaa130b651fcbb66ba5970371fc Mon Sep 17 00:00:00 2001 From: Aleksei Gagarin Date: Wed, 30 Oct 2024 15:49:49 +0400 Subject: [PATCH 1/5] Support google protobuf v4 (#1421) --- proto/otel/composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proto/otel/composer.json b/proto/otel/composer.json index 1ee4865e8..95a701889 100644 --- a/proto/otel/composer.json +++ b/proto/otel/composer.json @@ -18,7 +18,7 @@ ], "require": { "php": "^8.0", - "google/protobuf": "^3.3.0" + "google/protobuf": "^3.22 || ^4.0" }, "autoload": { "psr-4": { From ea908b161d3e354adbc22f0267da215bfa5445a9 Mon Sep 17 00:00:00 2001 From: Severin Neumann Date: Tue, 5 Nov 2024 10:38:15 +0100 Subject: [PATCH 2/5] Rename phpdoc-to-github-pages to phpdoc-to-github-pages.yml (#1425) - follow up to #1418, where I named the file without the required YML suffix - Do not run on pull requests --- .../{phpdoc-to-github-pages => phpdoc-to-github-pages.yml} | 1 - 1 file changed, 1 deletion(-) rename .github/workflows/{phpdoc-to-github-pages => phpdoc-to-github-pages.yml} (98%) diff --git a/.github/workflows/phpdoc-to-github-pages b/.github/workflows/phpdoc-to-github-pages.yml similarity index 98% rename from .github/workflows/phpdoc-to-github-pages rename to .github/workflows/phpdoc-to-github-pages.yml index 69334e287..36648d157 100644 --- a/.github/workflows/phpdoc-to-github-pages +++ b/.github/workflows/phpdoc-to-github-pages.yml @@ -4,7 +4,6 @@ on: push: branches: - "main" - pull_request: workflow_dispatch: # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages From 38633fba0edeedbe149bd0d4a588fc7f41164204 Mon Sep 17 00:00:00 2001 From: Bob Strecansky Date: Wed, 6 Nov 2024 11:15:52 -0500 Subject: [PATCH 3/5] Update README.md (#1427) Adding API Documentation Link --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 2944e391b..10565533d 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,8 @@ This is the **[monorepo](https://en.wikipedia.org/wiki/Monorepo)** for the **mai Please read the official documentation: https://opentelemetry.io/docs/instrumentation/php/ +API Documentation is available here: https://open-telemetry.github.io/opentelemetry-php/ + ## Packages and versions | Package | Latest | From 7b5cbb50788799be5dadd0136bb3a17339da4eb5 Mon Sep 17 00:00:00 2001 From: John Spaetzel Date: Thu, 14 Nov 2024 21:42:53 -0800 Subject: [PATCH 4/5] guard against possible false value from file_get_contents in Host.php (#1430) --- src/SDK/Resource/Detectors/Host.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/SDK/Resource/Detectors/Host.php b/src/SDK/Resource/Detectors/Host.php index 7d74f6991..3a353cc67 100644 --- a/src/SDK/Resource/Detectors/Host.php +++ b/src/SDK/Resource/Detectors/Host.php @@ -54,7 +54,9 @@ private function getLinuxId(): ?string foreach ($paths as $path) { $file = $this->dir . $path; if (is_file($file) && is_readable($file)) { - return trim(file_get_contents($file)); + $contents = file_get_contents($file); + + return $contents !== false ? trim($contents) : null; } } @@ -65,7 +67,9 @@ private function getBsdId(): ?string { $file = $this->dir . self::PATH_ETC_HOSTID; if (is_file($file) && is_readable($file)) { - return trim(file_get_contents($file)); + $contents = file_get_contents($file); + + return $contents !== false ? trim($contents) : null; } $out = exec('which kenv && kenv -q smbios.system.uuid'); From 8857b0c103b8231c5d38d1eb07cb33ced0c5589f Mon Sep 17 00:00:00 2001 From: Chris Lightfoot-Wild Date: Sat, 16 Nov 2024 04:32:30 +0000 Subject: [PATCH 5/5] Added \Attribute::TARGET_PARAMETER to \OpenTelemetry\API\Instrumentation\SpanAttribute (#1433) Fixes #1429. --- src/API/Instrumentation/SpanAttribute.php | 2 +- .../API/Instrumentation/SpanAttributeTest.php | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/API/Instrumentation/SpanAttribute.php b/src/API/Instrumentation/SpanAttribute.php index b2dcd1ef8..1a9fa1d13 100644 --- a/src/API/Instrumentation/SpanAttribute.php +++ b/src/API/Instrumentation/SpanAttribute.php @@ -11,7 +11,7 @@ * attribute, adding this attribute to an argument will * add the argument as a span attribute. */ -#[Attribute(Attribute::TARGET_PROPERTY)] +#[Attribute(Attribute::TARGET_PARAMETER | Attribute::TARGET_PROPERTY)] final class SpanAttribute { /** diff --git a/tests/Unit/API/Instrumentation/SpanAttributeTest.php b/tests/Unit/API/Instrumentation/SpanAttributeTest.php index d6437aa82..cc905ecde 100644 --- a/tests/Unit/API/Instrumentation/SpanAttributeTest.php +++ b/tests/Unit/API/Instrumentation/SpanAttributeTest.php @@ -5,7 +5,9 @@ namespace OpenTelemetry\Tests\Unit\API\Instrumentation; use OpenTelemetry\API\Instrumentation\SpanAttribute; +use OpenTelemetry\API\Instrumentation\WithSpan; use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DoesNotPerformAssertions; use PHPUnit\Framework\TestCase; #[CoversClass(SpanAttribute::class)] @@ -16,4 +18,17 @@ public function test_with_span(): void $attr = new SpanAttribute('foo'); $this->assertSame('foo', $attr->name); } + + #[DoesNotPerformAssertions] + public function test_attribute_targets_parameter(): void + { + new class() { + #[WithSpan] + public function foo( + #[SpanAttribute] string $a, + #[SpanAttribute('a_better_attribute_name')] string $b, + ): void { + } + }; + } }