Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Propagate Lambda ResourceId or FaasId for the child spans #104

Merged
merged 1 commit into from
Oct 19, 2024

Conversation

mxiamxia
Copy link
Member

@mxiamxia mxiamxia commented Oct 16, 2024

Description of changes:
For Lambda case, the Lambda resource attribute only exists on Handler span, it needs to be propagated to its child spans. This PR includes the changes,

  1. if parent span contains cloud.resource_id or faas.i but not in child span, child span will be propagated with one of these attribute from parent.
  2. if both exist cloud.resource_id takes priority
  3. if none of two Lambda resource attrs exists, do nothing.

Test:

Hander Span

2024-10-16T17:53:20.216Z | 'faas.id': 'arn:aws:lambda:us-west-1:889414516288:function:aws-opentelemetry-distro-nodejs',
-- | --
  | 2024-10-16T17:53:20.216Z | 'cloud.account.id': '889414516288',
  | 2024-10-16T17:53:20.216Z | 'aws.is.local.root': true,
  | 2024-10-16T17:53:20.216Z | 'aws.local.service': 'aws-opentelemetry-distro-nodejs',
  | 2024-10-16T17:53:20.216Z | 'aws.local.operation': 'aws-opentelemetry-distro-nodejs/Handler',

Child Span

  | 2024-10-16T17:53:20.194Z | attributes: {
-- | -- | --
  | 2024-10-16T17:53:20.194Z | 'rpc.system': 'aws-api',
  | 2024-10-16T17:53:20.194Z | 'rpc.method': 'ListBuckets',
  | 2024-10-16T17:53:20.194Z | 'rpc.service': 'S3',
  | 2024-10-16T17:53:20.194Z | 'aws.is.local.root': false,
  | 2024-10-16T17:53:20.194Z | 'faas.id': 'arn:aws:lambda:us-west-1:889414516288:function:aws-opentelemetry-distro-nodejs',
  | 2024-10-16T17:53:20.194Z | 'aws.local.operation': 'aws-opentelemetry-distro-nodejs/Handler',

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@mxiamxia mxiamxia marked this pull request as ready for review October 16, 2024 05:21
@mxiamxia mxiamxia requested a review from a team as a code owner October 16, 2024 05:21
@mxiamxia mxiamxia merged commit 7ee5904 into aws-observability:main Oct 19, 2024
9 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.

2 participants