Create metric for worker lambda processing rate #795
Merged
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.
What does this change?
We currently use metrics to see the performance of the whole system. For worker lambdas we have a metric for the processing time, which includes the length of time a message sits on a queue. This is great for determining the impact of changes to the overall performance.
In future PRs we are going to test using batch api calls. This PR adds a new metric to enable us to evaluate improvements to the lambda function.
The
functionProcessingRate
is a metric for how quickly we process tokens. The rate is calculated by:number of tokens processed by a particular function invocation / function processing time in seconds
The result is that we get a metric representing the number of tokens being processed per second.
To capture this metric there were a number of changes required:
sentTime
, i.e. when the message landed on the queue, instead capturing when the function starts)How to test
Locally we can test to ensure the lambda compiles and runs successfully. We can see in the log messages that the relevant data was being created.
To test the new embedded metric the lambda logs needed to be parsed by AWS. I deployed to CODE and checked that we could see the lambda metric being recorded via the AWS console.