Epic: T360707
Description
Implement caching for the Metrics Platform Instrument Configurator (MPIC) data.
Per design doc:
The instrument configuration will be fetched from the following sources in order. At any stage, if the lookup succeeds, then we do not move to the next source.
DC-local cache
If the DC-local cache lookup hits, then we verify the cached instrument configuration with the integrity hash cached with it. If the cached instrument configuration is verified, then the lookup is successful
The app
- Acquire a lock
- Fetch the instrument configuration via the /api/v1/configuration/ app route
- If the fetch succeeds, then cache the instrument configuration and an integrity hash for 1 minute. Otherwise, continue to the next source
- Release the lock
Default configuration
Disables all instruments
Proposing a DC-local cache lifetime of 1 minute. Ignoring all other caches, this would correspond to an average 1440 requests per day per DC from the extension to the app.
Since the instrument configuration is bundled in a ResourceLoader module, we must consider this proposed TTL in the context of the caching guarantees of ResourceLoader:
Changes to styles and scripts take effect in most browsers within 5 minutes, and in all browsers within 10 minutes.
Acceptance Criteria
- Once the MPIC app is deployed, caching works as expected.
Required
- Unit/Integration tests?
- Documentation?
- Passed QA?