Skip to content

feat(lambda): read cloud.account.id from symlink in Lambda detector#1995

Open
RaphaelManke wants to merge 5 commits intoopen-telemetry:mainfrom
RaphaelManke:feat/cloud-account-id-symlink
Open

feat(lambda): read cloud.account.id from symlink in Lambda detector#1995
RaphaelManke wants to merge 5 commits intoopen-telemetry:mainfrom
RaphaelManke:feat/cloud-account-id-symlink

Conversation

@RaphaelManke
Copy link

@RaphaelManke RaphaelManke commented Feb 9, 2026

Summary

  • Reads cloud.account.id from the symlink at /tmp/.otel-aws-account-id created by the OTel Lambda Extension
  • Uses File.readlink() to read the symlink target
  • Logs at debug level if the symlink doesn't exist (rescue Errno::ENOENT, Errno::EINVAL)

Depends on

Changes

  • lambda.rb — Added readlink logic with ACCOUNT_ID_SYMLINK_PATH constant
  • Tests: happy path, leading zeros, missing symlink, not-a-symlink

Test plan

  • Unit test: symlink exists → cloud.account.id set correctly
  • Unit test: leading zeros preserved as string
  • Unit test: missing symlink → attribute absent, no error
  • Unit test: non-symlink file → attribute absent, no error

Read /tmp/.otel-account-id symlink (created by the OTel Lambda extension)
using File.readlink to populate the cloud.account.id resource attribute.
Silently skips if the symlink does not exist (ENOENT) or is not a symlink
(EINVAL). Account ID is treated as a string to preserve leading zeros.
@arielvalentin
Copy link
Contributor

@jterapin @alextwoods @NathanielRN May I ask for a review from AWS Ruby SDK team?

@github-actions
Copy link
Contributor

👋 This pull request has been marked as stale because it has been open with no activity. You can: comment on the issue or remove the stale label to hold stale off for a while, add the keep label to hold stale off permanently, or do nothing. If you do nothing this pull request will be closed eventually by the stale bot

@github-actions github-actions bot added the stale Marks an issue/PR stale label Mar 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

stale Marks an issue/PR stale

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants