Skip to content

Commit 72ceab9

Browse files
committed
release 3.1.1
1 parent 5120ade commit 72ceab9

4 files changed

Lines changed: 250 additions & 240 deletions

File tree

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,11 @@ Versioning is strictly based on [Semantic Versioning](https://semver.org/)
103103
* push commit and tag
104104
* upload rock to luarocks: `luarocks upload rockspecs/[name] --api-key=abc`
105105

106+
### 3.1.1 (19-Nov-2025)
107+
108+
* Fix: change default headers to empty table instead of an array to remove deprecation notice [#174](https://github.com/Kong/lua-resty-healthcheck/pull/174)
109+
110+
106111
### 3.1.0 (19-Jun-2024)
107112

108113
* Feat: remove version check of resty.events [#162](https://github.com/Kong/lua-resty-healthcheck/pull/162)

docs/index.html

Lines changed: 63 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -53,23 +53,25 @@ <h2>Topics</h2>
5353

5454
<h1>Module <code>resty.healthcheck</code></h1>
5555
<p>Healthcheck library for OpenResty.</p>
56-
<p><p> Some notes on the usage of this library:</p>
56+
<p>
57+
58+
59+
<p> Some notes on the usage of this library:</p>
5760

5861
<ul>
59-
<li><p>Each target will have 4 counters, 1 success counter and 3 failure
60-
counters (&lsquo;http&rsquo;, &lsquo;tcp&rsquo;, and &lsquo;timeout&rsquo;). Any failure will <em>only</em> reset the
61-
success counter, but a success will reset <em>all three</em> failure counters.</p></li>
62-
<li><p>All targets are uniquely identified by their IP address and port number
63-
combination, most functions take those as arguments.</p></li>
64-
<li><p>All keys in the SHM will be namespaced by the healthchecker name as
65-
provided to the <a href="index.html#new">new</a> function. Hence no collissions will occur on shm-keys
66-
as long as the <code>name</code> is unique.</p></li>
67-
<li><p>Active healthchecks will be synchronized across workers, such that only
68-
a single active healthcheck runs.</p></li>
69-
<li><p>Events will be raised in every worker, see <a href="https://github.com/Kong/lua-resty-worker-events">lua-resty-worker-events</a>
70-
for details.</p></li>
62+
<li><p>Each target will have 4 counters, 1 success counter and 3 failure
63+
counters ('http', 'tcp', and 'timeout'). Any failure will <em>only</em> reset the
64+
success counter, but a success will reset <em>all three</em> failure counters.</p></li>
65+
<li><p>All targets are uniquely identified by their IP address and port number
66+
combination, most functions take those as arguments.</p></li>
67+
<li><p>All keys in the SHM will be namespaced by the healthchecker name as
68+
provided to the <a href="index.html#new">new</a> function. Hence no collissions will occur on shm-keys
69+
as long as the <code>name</code> is unique.</p></li>
70+
<li><p>Active healthchecks will be synchronized across workers, such that only
71+
a single active healthcheck runs.</p></li>
72+
<li><p>Events will be raised in every worker, see <a href="https://github.com/Kong/lua-resty-worker-events">lua-resty-worker-events</a>
73+
for details.</p></li>
7174
</ul>
72-
7375
</p>
7476
<h3>Info:</h3>
7577
<ul>
@@ -178,7 +180,8 @@ <h2 class="section-header "><a name="Functions"></a>Functions</h2>
178180
<strong>run_locked (self, key, fn, ...)</strong>
179181
</dt>
180182
<dd>
181-
<p>Acquire a lock and run a function</p>
183+
184+
<p>Acquire a lock and run a function</p>
182185

183186
<p> The function call itself is wrapped with <a href="https://www.lua.org/manual/5.1/manual.html#pdf-pcall">pcall</a> to protect against
184187
exception. </p>
@@ -187,11 +190,11 @@ <h2 class="section-header "><a name="Functions"></a>Functions</h2>
187190
non-yieldable phase such as <code>init_worker</code> or <code>log</code>:</p>
188191

189192
<ol>
190-
<li>The lock timeout is set to 0 to ensure that <code>resty.lock</code> does not
191-
attempt to sleep/yield</li>
192-
<li>If acquiring the lock fails due to a timeout, <a href="index.html#run_locked">run_locked</a>
193-
(this function) is re-scheduled to run in a timer. In this case,
194-
the function returns <code>&quot;scheduled&quot;</code></li>
193+
<li>The lock timeout is set to 0 to ensure that <code>resty.lock</code> does not
194+
attempt to sleep/yield</li>
195+
<li>If acquiring the lock fails due to a timeout, <a href="index.html#run_locked">run_locked</a>
196+
(this function) is re-scheduled to run in a timer. In this case,
197+
the function returns <code>&quot;scheduled&quot;</code></li>
195198
</ol>
196199

197200

@@ -255,12 +258,12 @@ <h3>Fields:</h3>
255258
</li>
256259
<li><span class="parameter">mostly_healthy</span>
257260
This event is raised when the target status is
258-
still healthy but it started to receive &ldquo;unhealthy&rdquo; updates via active or
261+
still healthy but it started to receive "unhealthy" updates via active or
259262
passive checks.
260263
</li>
261264
<li><span class="parameter">mostly_unhealthy</span>
262265
This event is raised when the target status is
263-
still unhealthy but it started to receive &ldquo;healthy&rdquo; updates via active or
266+
still unhealthy but it started to receive "healthy" updates via active or
264267
passive checks.
265268
</li>
266269
</ul>
@@ -456,8 +459,8 @@ <h2 class="section-header has-description"><a name="Health_management"></a>Healt
456459
<dd>
457460
Report a health failure.
458461
Reports a health failure which will count against the number of occurrences
459-
required to make a target &ldquo;fall&rdquo;. The type of healthchecker,
460-
&ldquo;tcp&rdquo; or &ldquo;http&rdquo; (see <a href="index.html#new">new</a>) determines against which counter the occurence goes.
462+
required to make a target "fall". The type of healthchecker,
463+
"tcp" or "http" (see <a href="index.html#new">new</a>) determines against which counter the occurence goes.
461464
If <code>unhealthy.tcp_failures</code> (for TCP failures) or <code>unhealthy.http_failures</code>
462465
is set to zero in the configuration, this function is a no-op
463466
and returns <code>true</code>.
@@ -475,7 +478,7 @@ <h3>Parameters:</h3>
475478
(optional) hostname of the target being checked.
476479
</li>
477480
<li><span class="parameter">check</span>
478-
(optional) the type of check, either &ldquo;passive&rdquo; or &ldquo;active&rdquo;, default &ldquo;passive&rdquo;.
481+
(optional) the type of check, either "passive" or "active", default "passive".
479482
</li>
480483
</ul>
481484

@@ -518,7 +521,7 @@ <h3>Parameters:</h3>
518521
the http statuscode, or nil to report an invalid http response.
519522
</li>
520523
<li><span class="parameter">check</span>
521-
(optional) the type of check, either &ldquo;passive&rdquo; or &ldquo;active&rdquo;, default &ldquo;passive&rdquo;.
524+
(optional) the type of check, either "passive" or "active", default "passive".
522525
</li>
523526
</ul>
524527

@@ -540,7 +543,7 @@ <h3>Returns:</h3>
540543
<dd>
541544
Report a health success.
542545
Reports a health success which will count against the number of occurrences
543-
required to make a target &ldquo;rise&rdquo;.
546+
required to make a target "rise".
544547
If <code>healthy.successes</code> is set to zero in the configuration,
545548
this function is a no-op and returns <code>true</code>.
546549

@@ -557,7 +560,7 @@ <h3>Parameters:</h3>
557560
(optional) hostname of the target being checked.
558561
</li>
559562
<li><span class="parameter">check</span>
560-
(optional) the type of check, either &ldquo;passive&rdquo; or &ldquo;active&rdquo;, default &ldquo;passive&rdquo;.
563+
(optional) the type of check, either "passive" or "active", default "passive".
561564
</li>
562565
</ul>
563566

@@ -594,13 +597,13 @@ <h3>Parameters:</h3>
594597
</li>
595598
<li><span class="parameter">operation</span>
596599
The socket operation that failed:
597-
&ldquo;connect&rdquo;, &ldquo;send&rdquo; or &ldquo;receive&rdquo;.
600+
"connect", "send" or "receive".
598601
TODO check what kind of information we get from the OpenResty layer
599602
in order to tell these error conditions apart
600-
https://github.com/openresty/lua-resty-core/blob/master/lib/ngx/balancer.md#get_last_failure
603+
https://github.com/openresty/lua-resty-core/blob/master/lib/ngx/balancer.md#get<em>last</em>failure
601604
</li>
602605
<li><span class="parameter">check</span>
603-
(optional) the type of check, either &ldquo;passive&rdquo; or &ldquo;active&rdquo;, default &ldquo;passive&rdquo;.
606+
(optional) the type of check, either "passive" or "active", default "passive".
604607
</li>
605608
</ul>
606609

@@ -636,7 +639,7 @@ <h3>Parameters:</h3>
636639
(optional) hostname of the target being checked.
637640
</li>
638641
<li><span class="parameter">check</span>
639-
(optional) the type of check, either &ldquo;passive&rdquo; or &ldquo;active&rdquo;, default &ldquo;passive&rdquo;.
642+
(optional) the type of check, either "passive" or "active", default "passive".
640643
</li>
641644
</ul>
642645

@@ -769,7 +772,7 @@ <h3>Returns:</h3>
769772
It will be started upon creation.</p>
770773

771774
<p> <em>NOTE</em>: the returned <code>checker</code> object must be anchored, if not it will be
772-
removed by Lua&rsquo;s garbage collector and the healthchecks will cease to run.
775+
removed by Lua's garbage collector and the healthchecks will cease to run.
773776

774777

775778
<h3>Parameters:</h3>
@@ -778,35 +781,34 @@ <h3>Parameters:</h3>
778781
table with checker options. Options are:</p>
779782

780783
<ul>
781-
<li><code>name</code>: name of the health checker</li>
782-
<li><code>shm_name</code>: the name of the <code>lua_shared_dict</code> specified in the Nginx configuration to use</li>
783-
<li><code>ssl_cert</code>: certificate for mTLS connections (string or parsed object)</li>
784-
<li><code>ssl_key</code>: key for mTLS connections (string or parsed object)</li>
785-
<li><code>checks.active.type</code>: &ldquo;http&rdquo;, &ldquo;https&rdquo; or &ldquo;tcp&rdquo; (default is &ldquo;http&rdquo;)</li>
786-
<li><code>checks.active.timeout</code>: socket timeout for active checks (in seconds)</li>
787-
<li><code>checks.active.concurrency</code>: number of targets to check concurrently</li>
788-
<li><code>checks.active.http_path</code>: path to use in <code>GET</code> HTTP request to run on active checks</li>
789-
<li><code>checks.active.https_sni</code>: SNI server name incase of HTTPS</li>
790-
<li><code>checks.active.https_verify_certificate</code>: boolean indicating whether to verify the HTTPS certificate</li>
791-
<li><code>checks.active.headers</code>: one or more lists of values indexed by header name</li>
792-
<li><code>checks.active.healthy.interval</code>: interval between checks for healthy targets (in seconds)</li>
793-
<li><code>checks.active.healthy.http_statuses</code>: which HTTP statuses to consider a success</li>
794-
<li><code>checks.active.healthy.successes</code>: number of successes to consider a target healthy</li>
795-
<li><code>checks.active.unhealthy.interval</code>: interval between checks for unhealthy targets (in seconds)</li>
796-
<li><code>checks.active.unhealthy.http_statuses</code>: which HTTP statuses to consider a failure</li>
797-
<li><code>checks.active.unhealthy.tcp_failures</code>: number of TCP failures to consider a target unhealthy</li>
798-
<li><code>checks.active.unhealthy.timeouts</code>: number of timeouts to consider a target unhealthy</li>
799-
<li><code>checks.active.unhealthy.http_failures</code>: number of HTTP failures to consider a target unhealthy</li>
800-
<li><code>checks.passive.type</code>: &ldquo;http&rdquo;, &ldquo;https&rdquo; or &ldquo;tcp&rdquo; (default is &ldquo;http&rdquo;; for passive checks, &ldquo;http&rdquo; and &ldquo;https&rdquo; are equivalent)</li>
801-
<li><code>checks.passive.healthy.http_statuses</code>: which HTTP statuses to consider a failure</li>
802-
<li><code>checks.passive.healthy.successes</code>: number of successes to consider a target healthy</li>
803-
<li><code>checks.passive.unhealthy.http_statuses</code>: which HTTP statuses to consider a success</li>
804-
<li><code>checks.passive.unhealthy.tcp_failures</code>: number of TCP failures to consider a target unhealthy</li>
805-
<li><code>checks.passive.unhealthy.timeouts</code>: number of timeouts to consider a target unhealthy</li>
806-
<li><code>checks.passive.unhealthy.http_failures</code>: number of HTTP failures to consider a target unhealthy</li>
784+
<li><code>name</code>: name of the health checker</li>
785+
<li><code>shm_name</code>: the name of the <code>lua_shared_dict</code> specified in the Nginx configuration to use</li>
786+
<li><code>ssl_cert</code>: certificate for mTLS connections (string or parsed object)</li>
787+
<li><code>ssl_key</code>: key for mTLS connections (string or parsed object)</li>
788+
<li><code>checks.active.type</code>: "http", "https" or "tcp" (default is "http")</li>
789+
<li><code>checks.active.timeout</code>: socket timeout for active checks (in seconds)</li>
790+
<li><code>checks.active.concurrency</code>: number of targets to check concurrently</li>
791+
<li><code>checks.active.http_path</code>: path to use in <code>GET</code> HTTP request to run on active checks</li>
792+
<li><code>checks.active.https_sni</code>: SNI server name incase of HTTPS</li>
793+
<li><code>checks.active.https_verify_certificate</code>: boolean indicating whether to verify the HTTPS certificate</li>
794+
<li><code>checks.active.headers</code>: one or more lists of values indexed by header name</li>
795+
<li><code>checks.active.healthy.interval</code>: interval between checks for healthy targets (in seconds)</li>
796+
<li><code>checks.active.healthy.http_statuses</code>: which HTTP statuses to consider a success</li>
797+
<li><code>checks.active.healthy.successes</code>: number of successes to consider a target healthy</li>
798+
<li><code>checks.active.unhealthy.interval</code>: interval between checks for unhealthy targets (in seconds)</li>
799+
<li><code>checks.active.unhealthy.http_statuses</code>: which HTTP statuses to consider a failure</li>
800+
<li><code>checks.active.unhealthy.tcp_failures</code>: number of TCP failures to consider a target unhealthy</li>
801+
<li><code>checks.active.unhealthy.timeouts</code>: number of timeouts to consider a target unhealthy</li>
802+
<li><code>checks.active.unhealthy.http_failures</code>: number of HTTP failures to consider a target unhealthy</li>
803+
<li><code>checks.passive.type</code>: "http", "https" or "tcp" (default is "http"; for passive checks, "http" and "https" are equivalent)</li>
804+
<li><code>checks.passive.healthy.http_statuses</code>: which HTTP statuses to consider a failure</li>
805+
<li><code>checks.passive.healthy.successes</code>: number of successes to consider a target healthy</li>
806+
<li><code>checks.passive.unhealthy.http_statuses</code>: which HTTP statuses to consider a success</li>
807+
<li><code>checks.passive.unhealthy.tcp_failures</code>: number of TCP failures to consider a target unhealthy</li>
808+
<li><code>checks.passive.unhealthy.timeouts</code>: number of timeouts to consider a target unhealthy</li>
809+
<li><code>checks.passive.unhealthy.http_failures</code>: number of HTTP failures to consider a target unhealthy</li>
807810
</ul>
808811

809-
810812
<p> If any of the health counters above (e.g. <code>checks.passive.unhealthy.timeouts</code>)
811813
is set to zero, the according category of checks is not taken to account.
812814
This way active or passive health checks can be disabled selectively.
@@ -830,7 +832,7 @@ <h3>Returns:</h3>
830832
</div> <!-- id="main" -->
831833
<div id="about">
832834
<i>generated by <a href="http://github.com/lunarmodules/LDoc">LDoc 1.5.0</a></i>
833-
<i style="float:right;">Last updated 2024-06-19 21:43:00 </i>
835+
<i style="float:right;">Last updated 2025-11-19 15:24:06 </i>
834836
</div> <!-- id="about" -->
835837
</div> <!-- id="container" -->
836838
</body>

0 commit comments

Comments
 (0)