Skip to content

Avoid throwing for non-string process executable names - #4540

Open
ryux1 wants to merge 1 commit into
open-telemetry:mainfrom
ryux1:fix/resource-non-string-executable-name
Open

Avoid throwing for non-string process executable names#4540
ryux1 wants to merge 1 commit into
open-telemetry:mainfrom
ryux1:fix/resource-non-string-executable-name

Conversation

@ryux1

@ryux1 ryux1 commented Sep 8, 2026

Copy link
Copy Markdown

Fixes #4535

Changes

  • read process.executable.name with nostd::get_if when deriving the fallback service name
  • fall back to unknown_service when the attribute exists with a non-string value
  • preserve unknown_service:<process.executable.name> for valid string values
  • add regression coverage for both paths

Validation

  • reproduced the original bad_variant_access failure with the new regression test before applying the fix
  • all 16 resource tests pass with C++14 under ABI v1
  • all 16 resource tests pass with C++14 under ABI v2
  • opentelemetry_resources builds with C++14 and -fno-exceptions
  • clang-format 18 dry-run passes

For significant contributions:

  • CHANGELOG.md updated for non-trivial changes
  • Unit tests have been added
  • Changes in public API reviewed (this PR does not change the public API)

Implementation, tests, and this description were prepared with OpenAI Codex assistance.

@ryux1
ryux1 requested a review from a team as a code owner September 8, 2026 04:42
@linux-foundation-easycla

linux-foundation-easycla Bot commented Sep 8, 2026

Copy link
Copy Markdown

CLA Not Signed

@codecov

codecov Bot commented Sep 8, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.48%. Comparing base (30322cf) to head (d86d10a).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #4540      +/-   ##
==========================================
+ Coverage   83.47%   83.48%   +0.01%     
==========================================
  Files         522      522              
  Lines       20440    20442       +2     
==========================================
+ Hits        17061    17064       +3     
+ Misses       3379     3378       -1     
Files with missing lines Coverage Δ
sdk/src/resource/resource.cc 97.23% <100.00%> (+3.11%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ryux1
ryux1 force-pushed the fix/resource-non-string-executable-name branch from d86d10a to e88afb7 Compare September 8, 2026 14:08

@owent owent left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM after CLA is signed.

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.

[BUG] Resource::Create() throws bad_variant_access if process.executable.name isn't a string

2 participants