Skip to content

Revert "Fix getLabel() deprecation warning with Protobuf 4.33+"#1880

Merged
brettmc merged 1 commit into
open-telemetry:mainfrom
Nevay:revert-1854-patch-1
Feb 5, 2026
Merged

Revert "Fix getLabel() deprecation warning with Protobuf 4.33+"#1880
brettmc merged 1 commit into
open-telemetry:mainfrom
Nevay:revert-1854-patch-1

Conversation

@Nevay

@Nevay Nevay commented Jan 30, 2026

Copy link
Copy Markdown
Contributor

Reverts #1854 / resolves #1879.
The ::getLabel() method was deprecated in protobuf 4.31, ::traverseDescriptor() (which uses ::getLabel()) won't be called with protobuf ^4.31 due to #1593. Related earlier PR that was closed for to the same reason: #1596

@Nevay
Nevay requested a review from a team as a code owner January 30, 2026 10:20
@codecov

codecov Bot commented Jan 30, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 68.33%. Comparing base (08f0dc1) to head (4849b16).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/Contrib/Otlp/ProtobufSerializer.php 0.00% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff              @@
##               main    #1880      +/-   ##
============================================
+ Coverage     68.22%   68.33%   +0.10%     
  Complexity     3009     3009              
============================================
  Files           449      449              
  Lines          8796     8798       +2     
============================================
+ Hits           6001     6012      +11     
+ Misses         2795     2786       -9     
Flag Coverage Δ
8.2 68.31% <0.00%> (+0.08%) ⬆️
8.3 68.31% <0.00%> (+0.10%) ⬆️
8.4 68.20% <0.00%> (ø)
8.5 67.38% <0.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/Contrib/Otlp/ProtobufSerializer.php 17.18% <0.00%> (ø)

... and 7 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 08f0dc1...4849b16. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@brettmc brettmc left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like getLabel will be removed in 5.34 (currently a release candicate), so we probably need an issue to implement a future fix that works with protobuf 4.x and 5.x ?

@Nevay

Nevay commented Feb 3, 2026

Copy link
Copy Markdown
Contributor Author

Any version with PrintOptions won't use getLabel -> the code should already work with 5.34.

@brettmc
brettmc merged commit 26a2a4e into open-telemetry:main Feb 5, 2026
8 of 9 checks passed
bobstrecansky added a commit to bobstrecansky/opentelemetry-php that referenced this pull request May 20, 2026
Three issues are currently failing PHP QA on main:

1. Psalm reports 32 UndefinedDocblockClass errors against
   Google\Protobuf\Internal\RepeatedField on every Otlp converter.
   google/protobuf 4.x deprecated the Internal class in favor of
   Google\Protobuf\RepeatedField; the legacy name is now a runtime
   class_alias that Psalm's static parser cannot see. Add an
   UndefinedDocblockClass suppression alongside the existing
   UndefinedMethod suppression for the same class.

2. The PHP 8.1 matrix job fails composer install because
   phpspec/prophecy 1.26 dropped PHP 8.1 in 1.23 and requires
   phpdocumentor/reflection-docblock ^6, which itself needs prophecy
   1.26. Revert both renovate bumps (open-telemetry#1915, open-telemetry#1919) to the prior
   constraints so the project's declared "php": "^8.1" support holds.

3. With Psalm fixed, PHPStan now runs and reports an undefined
   method Google\Protobuf\FieldDescriptor::getLabel() in
   ProtobufSerializer::traverseDescriptor(). That branch is dead
   code under google/protobuf >= 4.31 (the serializeToJsonString
   path returns early via PrintOptions), but PHPStan cannot infer
   that. See open-telemetry#1880, which reverted the prior compile-time fix for
   the same reason. Suppress the warning scoped to the one file.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[exporter-otlp] Requirement for google/protobuf is too loose

2 participants