This repository has been archived by the owner on Apr 3, 2019. It is now read-only.
fix(metrics): ensure email events use stashed flow data where applicable #2677
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.
Fixes #2675.
A number of places that were sending emails assumed they had access to flowId and flowBeginTime on the request payload. However, we're in the process of changing some of those endpoints so that they don't receive metrics context data in the payload.
To fix this, all endpoints are changed here to read metrics context data via a lazy getter that falls back to loading from memcached if there's no flow data in the payload. This happened to be a nice refactor anyway, fitting in with our broader adoption of lazy getters. It makes the code more resilient to change and reduces the frequency that we hit the cache with.
Note this is the same commit as #2676, but opened against the correct train branch because I am a short-sighted fool.
@vbudhram r?