diff options
Diffstat (limited to 'plugin/erratic')
-rw-r--r-- | plugin/erratic/README.md | 4 | ||||
-rw-r--r-- | plugin/erratic/health.go | 14 |
2 files changed, 18 insertions, 0 deletions
diff --git a/plugin/erratic/README.md b/plugin/erratic/README.md index f606eef42..3f3f75d3d 100644 --- a/plugin/erratic/README.md +++ b/plugin/erratic/README.md @@ -25,6 +25,10 @@ erratic { * `delay`: delay 1 per **AMOUNT** of queries for **DURATION**, the default for **AMOUNT** is 2 and the default for **DURATION** is 100ms. +## Health + +This plugin implements dynamic health checking. For every dropped query it turns unhealthy. + ## Examples ~~~ corefile diff --git a/plugin/erratic/health.go b/plugin/erratic/health.go new file mode 100644 index 000000000..1d9625e16 --- /dev/null +++ b/plugin/erratic/health.go @@ -0,0 +1,14 @@ +package erratic + +import ( + "sync/atomic" +) + +// Health implements the health.Healther interface. +func (e *Erratic) Health() bool { + q := atomic.LoadUint64(&e.q) + if e.drop > 0 && q%e.drop == 0 { + return false + } + return true +} |