diff --git a/.github/workflows/build_and_test_with_resty_events.yml b/.github/workflows/build_and_test_with_resty_events.yml index 2b375342..71434c69 100644 --- a/.github/workflows/build_and_test_with_resty_events.yml +++ b/.github/workflows/build_and_test_with_resty_events.yml @@ -135,4 +135,4 @@ jobs: run: | eval `luarocks path` eval $(perl -I $HOME/perl5/lib/perl5/ -Mlocal::lib) - TEST_NGINX_RANDOMIZE=1 prove -I. -r t/with_resty-events + TEST_NGINX_TIMEOUT=4 TEST_NGINX_RANDOMIZE=1 prove -I. -r t/with_resty-events diff --git a/.github/workflows/build_and_test_with_worker_events.yml b/.github/workflows/build_and_test_with_worker_events.yml index a78f314c..6129706e 100644 --- a/.github/workflows/build_and_test_with_worker_events.yml +++ b/.github/workflows/build_and_test_with_worker_events.yml @@ -8,7 +8,7 @@ jobs: runs-on: ubuntu-20.04 strategy: matrix: - openresty-version: [1.19.9.1, 1.21.4.1] + openresty-version: [1.21.4.1] steps: - name: Update and install OS dependencies @@ -61,4 +61,4 @@ jobs: run: | eval `luarocks path` eval $(perl -I $HOME/perl5/lib/perl5/ -Mlocal::lib) - TEST_NGINX_RANDOMIZE=1 prove -I. -r t/with_worker-events + TEST_NGINX_TIMEOUT=4 TEST_NGINX_RANDOMIZE=1 prove -I. -r t/with_worker-events diff --git a/docs/index.html b/docs/index.html index 52451055..39b82e55 100644 --- a/docs/index.html +++ b/docs/index.html @@ -53,23 +53,25 @@
resty.healthcheck
Healthcheck library for OpenResty.
-Some notes on the usage of this library:
++ + +
Some notes on the usage of this library:
Each target will have 4 counters, 1 success counter and 3 failure -counters (‘http’, ‘tcp’, and ‘timeout’). Any failure will only reset the -success counter, but a success will reset all three failure counters.
All targets are uniquely identified by their IP address and port number -combination, most functions take those as arguments.
All keys in the SHM will be namespaced by the healthchecker name as
-provided to the new function. Hence no collissions will occur on shm-keys
-as long as the name
is unique.
Active healthchecks will be synchronized across workers, such that only -a single active healthcheck runs.
Events will be raised in every worker, see lua-resty-worker-events -for details.
Each target will have 4 counters, 1 success counter and 3 failure + counters ('http', 'tcp', and 'timeout'). Any failure will only reset the + success counter, but a success will reset all three failure counters.
All targets are uniquely identified by their IP address and port number + combination, most functions take those as arguments.
All keys in the SHM will be namespaced by the healthchecker name as
+ provided to the new function. Hence no collissions will occur on shm-keys
+ as long as the name
is unique.
Active healthchecks will be synchronized across workers, such that only + a single active healthcheck runs.
Events will be raised in every worker, see lua-resty-worker-events + for details.
The function call itself is wrapped with pcall to protect against +
The function call itself is wrapped with pcall to protect against exception.
Acquire a lock and run a function
-The function call itself is wrapped with pcall to protect against +
Acquire a lock and run a function
+ +The function call itself is wrapped with pcall to protect against exception.
This function exhibits some special behavior when called during a
non-yieldable phase such as init_worker
or log
:
resty.lock
does not
-attempt to sleep/yield"scheduled"
resty.lock
does not
+ attempt to sleep/yield"scheduled"
unhealthy.tcp_failures
(for TCP failures) or unhealthy.http_failures
is set to zero in the configuration, this function is a no-op
and returns true
.
@@ -475,7 +478,7 @@ healthy.successes
is set to zero in the configuration,
this function is a no-op and returns true
.
@@ -557,7 +560,7 @@ NOTE: the returned checker
object must be anchored, if not it will be
- removed by Lua’s garbage collector and the healthchecks will cease to run.
+ removed by Lua's garbage collector and the healthchecks will cease to run.
name
: name of the health checkershm_name
: the name of the lua_shared_dict
specified in the Nginx configuration to usessl_cert
: certificate for mTLS connections (string or parsed object)ssl_key
: key for mTLS connections (string or parsed object)checks.active.type
: “http”, “https” or “tcp” (default is “http”)checks.active.timeout
: socket timeout for active checks (in seconds)checks.active.concurrency
: number of targets to check concurrentlychecks.active.http_path
: path to use in GET
HTTP request to run on active checkschecks.active.https_sni
: SNI server name incase of HTTPSchecks.active.https_verify_certificate
: boolean indicating whether to verify the HTTPS certificatechecks.active.headers
: one or more lists of values indexed by header namechecks.active.healthy.interval
: interval between checks for healthy targets (in seconds)checks.active.healthy.http_statuses
: which HTTP statuses to consider a successchecks.active.healthy.successes
: number of successes to consider a target healthychecks.active.unhealthy.interval
: interval between checks for unhealthy targets (in seconds)checks.active.unhealthy.http_statuses
: which HTTP statuses to consider a failurechecks.active.unhealthy.tcp_failures
: number of TCP failures to consider a target unhealthychecks.active.unhealthy.timeouts
: number of timeouts to consider a target unhealthychecks.active.unhealthy.http_failures
: number of HTTP failures to consider a target unhealthychecks.passive.type
: “http”, “https” or “tcp” (default is “http”; for passive checks, “http” and “https” are equivalent)checks.passive.healthy.http_statuses
: which HTTP statuses to consider a failurechecks.passive.healthy.successes
: number of successes to consider a target healthychecks.passive.unhealthy.http_statuses
: which HTTP statuses to consider a successchecks.passive.unhealthy.tcp_failures
: number of TCP failures to consider a target unhealthychecks.passive.unhealthy.timeouts
: number of timeouts to consider a target unhealthychecks.passive.unhealthy.http_failures
: number of HTTP failures to consider a target unhealthyname
: name of the health checkershm_name
: the name of the lua_shared_dict
specified in the Nginx configuration to usessl_cert
: certificate for mTLS connections (string or parsed object)ssl_key
: key for mTLS connections (string or parsed object)checks.active.type
: "http", "https" or "tcp" (default is "http")checks.active.timeout
: socket timeout for active checks (in seconds)checks.active.concurrency
: number of targets to check concurrentlychecks.active.http_path
: path to use in GET
HTTP request to run on active checkschecks.active.https_sni
: SNI server name incase of HTTPSchecks.active.https_verify_certificate
: boolean indicating whether to verify the HTTPS certificatechecks.active.headers
: one or more lists of values indexed by header namechecks.active.healthy.interval
: interval between checks for healthy targets (in seconds)checks.active.healthy.http_statuses
: which HTTP statuses to consider a successchecks.active.healthy.successes
: number of successes to consider a target healthychecks.active.unhealthy.interval
: interval between checks for unhealthy targets (in seconds)checks.active.unhealthy.http_statuses
: which HTTP statuses to consider a failurechecks.active.unhealthy.tcp_failures
: number of TCP failures to consider a target unhealthychecks.active.unhealthy.timeouts
: number of timeouts to consider a target unhealthychecks.active.unhealthy.http_failures
: number of HTTP failures to consider a target unhealthychecks.passive.type
: "http", "https" or "tcp" (default is "http"; for passive checks, "http" and "https" are equivalent)checks.passive.healthy.http_statuses
: which HTTP statuses to consider a failurechecks.passive.healthy.successes
: number of successes to consider a target healthychecks.passive.unhealthy.http_statuses
: which HTTP statuses to consider a successchecks.passive.unhealthy.tcp_failures
: number of TCP failures to consider a target unhealthychecks.passive.unhealthy.timeouts
: number of timeouts to consider a target unhealthychecks.passive.unhealthy.http_failures
: number of HTTP failures to consider a target unhealthy If any of the health counters above (e.g. checks.passive.unhealthy.timeouts
)
is set to zero, the according category of checks is not taken to account.
This way active or passive health checks can be disabled selectively.
@@ -830,7 +832,7 @@