feat(lambda): write cloud.account.id symlink from extension#2127
Open
RaphaelManke wants to merge 1 commit intoopen-telemetry:mainfrom
Open
feat(lambda): write cloud.account.id symlink from extension#2127RaphaelManke wants to merge 1 commit intoopen-telemetry:mainfrom
RaphaelManke wants to merge 1 commit intoopen-telemetry:mainfrom
Conversation
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.
This was referenced Feb 9, 2026
serkan-ozal
approved these changes
Feb 12, 2026
herin049
reviewed
Feb 12, 2026
| "github.com/open-telemetry/opentelemetry-lambda/collector/lambdacomponents" | ||
| ) | ||
|
|
||
| const accountIDSymlinkPath = "/tmp/.otel-account-id" |
Contributor
There was a problem hiding this comment.
Small nit:
Suggested change
| const accountIDSymlinkPath = "/tmp/.otel-account-id" | |
| const accountIDSymlinkPath = "/tmp/.otel-aws-account-id" |
Contributor
There was a problem hiding this comment.
Looks like you've already made the PRs for all the contrib repos, so to save the effort of changing the name everywhere, .otel-account-id is probably fine.
Contributor
There was a problem hiding this comment.
Agree since all the other PRs have already been created, we can leave it as is.
| // Remove any stale symlink from a previous execution environment reuse. | ||
| os.Remove(accountIDSymlinkPath) | ||
| if err := os.Symlink(accountID, accountIDSymlinkPath); err != nil { | ||
| logger.Debug("Failed to create account ID symlink", zap.Error(err)) |
Contributor
There was a problem hiding this comment.
Maybe we should make this a Warning log instead of debug?
wpessers
approved these changes
Feb 13, 2026
Contributor
wpessers
left a comment
There was a problem hiding this comment.
Thank you for the contribution. Will merge as soon as the open remarks have been addressed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Register()call, the extension now creates a symlink at/tmp/.otel-account-idwith the AWS account ID as the targetaccountIdfeature via theLambda-Extension-Accept-Feature: accountIdheaderThis enables all OTel SDK Lambda resource detectors to read
cloud.account.idviareadlink()without needing IAM calls.Changes
collector/internal/extensionapi/client.go— ParseaccountIdfrom Register response, send Accept-Feature headercollector/internal/lifecycle/manager.go— Create symlink after registrationRelated PRs
SDK-side implementations that read this symlink (will be linked once created).
Test plan