⚠ This page is served via a proxy. Original site: https://github.com
This service does not collect credentials or authentication data.
Skip to content

Conversation

@RaphaelManke
Copy link

Summary

  • After the Lambda Extensions API Register() call, the extension now creates a symlink at /tmp/.otel-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 (debug 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.
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