Skip to content

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

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

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

Conversation

@RaphaelManke
Copy link

Summary

  • Reads cloud.account.id from the symlink at /tmp/.otel-account-id created by the OTel Lambda Extension
  • Uses File.readlink() to read the symlink target
  • Rescues Errno::ENOENT and Errno::EINVAL to silently skip if the symlink doesn't exist

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.
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.

1 participant