This is a second round of improvements to error logging. In T321164 we found that nothing was logged for a particular type of error, and found some places in the code where errors might fall through without logging.
- Log errors regardless of their "metrics" payload. Currently we skip logging under the assumption that the metrics will include the error, but statsd is insufficient for debugging.
- Exceptions from mapdata are not wired yet. These should show up in the main kartotherian log, at level "error".
- Attach failure information to each group or to request.
- Remove our previous attempt which logged from mapdata in many different promise rejection blocks, and allow the errors to bubble up to fail a single group.
- Kartographer mapdata consumers should handle per-group and per-batch failures.
- kartotherian mapdata consumer should handle per-group and per-batch failures.
- Fully test new behavior.
- This spun out a whole universe of "refactor mapdata".
- Tests to cover happy and unhappy paths for old code.
- Only dedupe once. There were several pieces of logic all intending to "deduplicate" mapdata requests by returning data already fetched. This is trivial, we can remove the complex code to support concurrent requests and map keys can be dropped in most places, using flat lists instead.
- Simplify promises. For example, in many places we wrap promises in another ad-hoc flavor, proxying the resolve and reject callbacks, etc.
- Drop class hierararchy
- Flatten geodata recursion: only certain combinations are supported. Simplify and tighten up so that only these structures are followed.
- Top-level mapdata can be an object or an array of objects.
- Each top-level object might include ExternalData which needs to be fetched.
- Split dependency injection from query parameters. These are different functions. DI is stored in context variables, query parameters are passed through with each function call.
- Nice to have: move "attribution" render to Kartographer
- Follow-up task: Collect all mapdata requests for a page and request in one query.
- Release mapdata 0.8 to npm and upgrade consumers.