0

I have a lambda that can be executed from various accounts. I wish to track how long the lambda executed for when executed by different accounts. AWS X-ray gives my the duration for which lambda executed by I can't corelate that information to the caller of the lambda function.

Is there a way to link the duration of execution of lambda function to caller to the function?

alwaysAStudent
  • 2,110
  • 4
  • 24
  • 47
  • How is the Lambda called? Do you have separate credentials for the calls? Are you calling it directly (i.e. like using the cli to do `aws lambda invoke`) or are you using something like API gateway? – stdunbar Apr 19 '20 at 15:17
  • Its being triggered via action on DynamoDB streams. The streams is enabled on a dynamodb table which is backing an API Gateway. A call to the API Gateway endpoint directly writes to dynamodb table which triggers a record in streams which invokes the Lambda. – alwaysAStudent Apr 20 '20 at 05:04
  • Ultimately you'll need a different user per call somehow. That could be a different API endpoint or other indication of the user (i.e. header value). You'll need to track that through DynamoDB (i.e. have a "user" field") and then passed to the Lambda. – stdunbar Apr 20 '20 at 14:12

1 Answers1

0

If you have the parameter(s) to identify the accounts on your lambda function, you may use "Annotations and metadata" feature of aws x-ray. After you make configuration it is going to be shown on your x-ray traces.

please check for official documentation

Edit: Since you are using java; you may try the example code

Ersoy
  • 8,816
  • 6
  • 34
  • 48