From 748f4d70cbed286df37d47c618340d5a9f9bfcd9 Mon Sep 17 00:00:00 2001 From: Elad Tabak Date: Sun, 23 Dec 2018 14:55:11 +0200 Subject: [PATCH] Fix README.md with proper order of arguments in functions Signed-off-by: Elad Tabak --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 9f8bf9a..0c4eb95 100644 --- a/README.md +++ b/README.md @@ -39,13 +39,13 @@ A trivial example of a check that runs every 5 seconds and shuts down our server return nil } - health.RegisterPeriodicFunc("minute_even", currentMinuteEvenCheck, time.Second*5) + health.RegisterPeriodicFunc("minute_even", time.Second*5, currentMinuteEvenCheck) ``` Alternatively, you can also make use of `RegisterPeriodicThresholdFunc` to implement the exact same check, but add a threshold of failures after which the check will be unhealthy. This is particularly useful for flaky Checks, ensuring some stability of the service when handling them. ```go -health.RegisterPeriodicThresholdFunc("minute_even", currentMinuteEvenCheck, time.Second*5, 4) +health.RegisterPeriodicThresholdFunc("minute_even" time.Second*5, 4, currentMinuteEvenCheck) ``` The lowest-level way to interact with the health package is calling `Register` directly. Register allows you to pass in an arbitrary string and something that implements `Checker` and runs your check. If your method returns an error with nil, it is considered a healthy check, otherwise it will make the health check endpoint `/debug/health` start returning a 500 and list the specific check that failed.