← All Exercises

Audit Feature Freshness Against SLAs

basicjavascript~20min

Background

A model served with stale features degrades without an error. Freshness SLAs per feature turn that silent failure into a visible alert.

Problem

Compare feature update ages with their per-feature SLA and report which features are stale and by how much.

Input

JSON object: { features: [{ name, ageMinutes, slaMinutes }] }

Output

JSON array of { name, overdueMinutes } sorted by overdue desc, then name

Sample tests

Sample 1

Input: {"features":[{"name":"user_ltv","ageMinutes":30,"slaMinutes":60},{"name":"cart_size","ageMinutes":120,"slaMinutes":60}]}
Expected: [{"name":"cart_size","overdueMinutes":60}]

Sample 2

Input: {"features":[{"name":"a","ageMinutes":90,"slaMinutes":60},{"name":"b","ageMinutes":200,"slaMinutes":120}]}
Expected: [{"name":"b","overdueMinutes":80},{"name":"a","overdueMinutes":30}]

Your solution

Learning objective

Monitor feature freshness with the same numbers used in training contracts.