Skip to content

Conversation

ramisa2108
Copy link
Contributor

Issue #, if available:

Description of changes:

  • Add tenant id to LambdaContext object and structured log messages

Target (OCI, Managed Runtime, both):

  • Both

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Copy link
Member

@maxday maxday left a comment

Choose a reason for hiding this comment

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

Awesome job @ramisa2108 ! 💯
I left only some small comments, let me know if that makes sense

}
}

@Test
Copy link
Member

Choose a reason for hiding this comment

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

great test! 💯

LambdaEnvironment.FUNCTION_VERSION,
request.getInvokedFunctionArn(),
clientContext
clientContext,
Copy link
Member

Choose a reason for hiding this comment

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

I think it would be great to leave the clientContext as the last parameter? This way we keep aws-related fields grouped. WDYT?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Great suggestion. Updated.

String functionVersion,
String invokedFunctionArn,
ClientContext clientContext
ClientContext clientContext,
Copy link
Member

Choose a reason for hiding this comment

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

same here, maybe it would be better to swap args

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated.

mockResponse.setHeader("lambda-runtime-aws-request-id", "1234567890");
mockResponse.setHeader("Content-Type", "application/json");
String expectedTenantId = "my-tenant-id";
mockResponse.setHeader("lambda-runtime-aws-tenant-id", expectedTenantId);
Copy link
Member

@maxday maxday Apr 16, 2025

Choose a reason for hiding this comment

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

I think it would be great to have another set of tests for:

  1. header not present
  2. header present and empty string
  3. header present and null value

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the suggestion. Added these test cases.

*/
std::chrono::time_point<std::chrono::system_clock> deadline;

/**
Copy link
Member

@maxday maxday Apr 16, 2025

Choose a reason for hiding this comment

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

hopefully at some point, we won't have a copy of aws-lambda-cpp in here, so let's keep that change here but I think you also need to modify the source of truth here: https://github.com/awslabs/aws-lambda-cpp? (Not blocking for this PR to be merged) I've also created an issue for us to track that change at some point: #541

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ack.

Copy link
Member

Choose a reason for hiding this comment

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

Agreed, one day, we could get rid of this. (Not blocking PR from my end either).

"function-arn",
null
null,
"tenant-id"
Copy link
Member

Choose a reason for hiding this comment

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

let's also add a test with a null value for tenant-id as it's optional

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added test with null tenant-id.

@ramisa2108 ramisa2108 force-pushed the ramisa2108/support-multi-tenancy branch from 30c667c to b7c13ac Compare April 17, 2025 10:59
Copy link
Member

@maxday maxday left a comment

Choose a reason for hiding this comment

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

🎉

Copy link
Member

@godcrampy godcrampy left a comment

Choose a reason for hiding this comment

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

Great work! 🎉

@ramisa2108 ramisa2108 merged commit 150b1b7 into aws:main Apr 22, 2025
2 checks passed
@ramisa2108 ramisa2108 deleted the ramisa2108/support-multi-tenancy branch April 22, 2025 09:53
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.

3 participants