Skip to content

feat(lambda): write cloud.account.id symlink from extension#2127

Merged
wpessers merged 4 commits intoopen-telemetry:mainfrom
RaphaelManke:feat/cloud-account-id-symlink
Feb 18, 2026
Merged

feat(lambda): write cloud.account.id symlink from extension#2127
wpessers merged 4 commits intoopen-telemetry:mainfrom
RaphaelManke:feat/cloud-account-id-symlink

Conversation

@RaphaelManke
Copy link
Contributor

@RaphaelManke RaphaelManke commented Feb 9, 2026

Summary

  • After the Lambda Extensions API Register() call, the extension now creates a symlink at /tmp/.otel-aws-account-id with the AWS account ID as the target
  • Requests the accountId feature via the Lambda-Extension-Accept-Feature: accountId header
  • Handles execution environment reuse by removing stale symlinks before creating new ones
  • Fails silently (warn log only) if symlink creation fails

This enables all OTel SDK Lambda resource detectors to read cloud.account.id via readlink() without needing IAM calls.

Changes

  • collector/internal/extensionapi/client.go — Parse accountId from Register response, send Accept-Feature header
  • collector/internal/lifecycle/manager.go — Create symlink after registration
  • Tests for both header/parsing and symlink creation/cleanup

Related PRs

SDK-side implementations that read this symlink (will be linked once created).

Test plan

  • Unit test: symlink created with correct target
  • Unit test: leading zeros preserved
  • Unit test: stale symlink replaced
  • Unit test: empty accountID skipped silently
  • Unit test: Accept-Feature header sent correctly
  • Unit test: accountId parsed from response JSON

Request the accountId feature from the Lambda Extensions API via the
Lambda-Extension-Accept-Feature header. After Register() returns, write
a symlink at /tmp/.otel-account-id whose target is the raw AWS account
ID string. This allows Lambda SDK resource detectors to read the account
ID without an additional API call.

The symlink is removed before creation to handle Lambda execution
environment reuse where /tmp persists. Failures are logged at debug
level and silently skipped.
Copy link
Contributor

@wpessers wpessers left a comment

Choose a reason for hiding this comment

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

Thank you for the contribution. Will merge as soon as the open remarks have been addressed.

Address review feedback:
- Rename symlink path from /tmp/.otel-account-id to /tmp/.otel-aws-account-id
- Change symlink creation failure log from Debug to Warn
Copy link
Contributor

@wpessers wpessers left a comment

Choose a reason for hiding this comment

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

Thanks @RaphaelManke 🚀 This will be included in the next release, should be either tomorrow or friday!

@wpessers wpessers merged commit 61acad8 into open-telemetry:main Feb 18, 2026
14 checks passed
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.

4 participants

Comments