mirror of https://github.com/grafana/loki
Improve error message if incoming logs timestamp is far too behind. (#5040)
* Improve error message if incoming logs timestamp is far too behind. This is part of JSON response giving out as the response to HTTP /push endpoint. Old message ``` {"code":400,"status":"error","message":"entry for stream '{foo=\"bar\"}' has timestamp too old: 1970-01-01 01:00:00.5 +0100 CET"} ``` New message ``` {"code":400,"status":"error","message":"entry for stream '{foo=\"bar\"}' has timestamp too old: 2021-12-28 01:48:45.5 +0100 CET, accepts timestamp from: 2021-12-29 09:48:45.737756651 +0100 CET"} ``` main rationale being, hard to know what is the closest timestamp that Loki is expecting without going through the config. Also config is not straight forward (its `latest stream's timestamp - ingester.max-chunk-age/2`) Signed-off-by: Kaviraj <kavirajkanagaraj@gmail.com> * Tweaks the error message Signed-off-by: Kaviraj <kavirajkanagaraj@gmail.com> * Fix `distributor/validator_test`. 1. Make `time.Now()` mockable. 2. Make time format consistent across error messages. Signed-off-by: Kaviraj <kavirajkanagaraj@gmail.com> * Rename `getValidationContextFor` to `getValidationContextForTime` Signed-off-by: Kaviraj <kavirajkanagaraj@gmail.com>pull/5049/head
parent
c0bec07e0d
commit
564f833a30
Loading…
Reference in new issue