Skip to content

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

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

feat(lambda): read cloud.account.id from symlink in Lambda detector#4183
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 os.readlink() to read the symlink target (the AWS account ID)
  • Logs at debug level if the symlink doesn't exist (except OSError guard)

Depends on

Changes

  • _lambda.py — Added readlink logic with _ACCOUNT_ID_SYMLINK_PATH constant
  • Tests: happy path, leading zeros preserved, missing symlink handled gracefully

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

…etector

Read /tmp/.otel-account-id via os.readlink() and set the
cloud.account.id resource attribute when the symlink exists.
Silently skip when the symlink is absent (OSError caught).
@RaphaelManke RaphaelManke force-pushed the feat/cloud-account-id-symlink branch from 4bdf2ac to c63fde7 Compare February 18, 2026 06:40
@RaphaelManke RaphaelManke force-pushed the feat/cloud-account-id-symlink branch from c63fde7 to 0f57fbc Compare February 18, 2026 06:43
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.

2 participants