okami.mom/strata
git clone https://git.nkp.pet/okami.mom/strata
53623e56f
main
1Implement a small command-line tool in Python called `logtally`. 2 3Requirements: 4- It reads newline-delimited JSON log records from stdin. Each record has `ts` (ISO-8601 string), `level` (one of DEBUG, INFO, WARN, ERROR), `service` (string), and optional `latency_ms` (number). 5- It prints, per service, the count of records by level and the p50 and p95 of `latency_ms` (ignore records without latency). 6- Malformed lines must be counted and reported at the end, never crash the program. 7- Support a `--since <ISO timestamp>` flag that drops earlier records. 8- Use only the standard library. 9 10After the code, explain in two or three sentences how you computed percentiles and why you chose that method, then list three edge cases a unit test suite should cover.