gitlab-labkit 2.8.1 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7ad3bb9ba369010544041c2ab2d2ec2d8610c535c5b2c5e592fe0e8313c56a66
4
- data.tar.gz: 4fa90bdb331f44920cc9969603db7189e42dec21c7fab1d7593e91455de323c3
3
+ metadata.gz: 5c4b2288dc9341d5acd02a9ad274702ad2c44793c5760f04b6597c7404cad509
4
+ data.tar.gz: f6bc276c4452b9952dcd5e194f76d74c787ba122ae39070d35fc507aec06d444
5
5
  SHA512:
6
- metadata.gz: 21c914360a54bb30e914e7b6771781657463b3febd83b81634b88513f2986d7d9f25016bae84781b69918429a49c13fdfdf7da8581d385bc13adb698c8728f1d
7
- data.tar.gz: e8b1b9f46c438e2608a1f12e55d2fd3f518586795dfb0327b08fed8bcd6496525fb0fba71c5212fdab45b45a3ca1b3b9c792dc212a838a98124be37d698fd823
6
+ metadata.gz: fb5d89354c732b5ea0ac8579422a2fd3212e2e79f9d035ad0bdb642258710e2c7cf43abbfbd9c6b6f95d4fe190799ddbbcaf34b0b3d51ff857c0a8330e56af7f
7
+ data.tar.gz: cea073f528c655e9df4df9715a6a7a5728f13c55e75190f2ace56ca15aba59ec84ac902037125b54de0f7631fbcd03120fd1a8caad3d8854481d39a73eeb11d6
@@ -146,7 +146,7 @@ A `Rule` is a `Data.define` value object with the following fields:
146
146
  | `match` | Hash of identifier key/value predicates that must **all** be satisfied for the rule to apply. Empty hash matches anything. See [Matchers](#matchers). |
147
147
  | `limit` | Integer request threshold per `period`. May be a callable resolved on every check. |
148
148
  | `period` | Window length in seconds. May be a callable resolved on every check. |
149
- | `action` | What the result reports when the limit is exceeded. One of `:block`, `:log`, `:allow`, `:skip`. Default `:block`. See [Actions](#actions). |
149
+ | `action` | What the result reports when the limit is exceeded. One of `:block`, `:log`, `:skip`. Default `:block`. See [Actions](#actions). |
150
150
  | `characteristics` | Array of identifier keys whose values are folded into the Redis counter key. Each unique combination gets its own counter. |
151
151
 
152
152
  Making `limit` or `period` callable is the supported pattern for
@@ -198,7 +198,7 @@ flowchart TD
198
198
  Build --> Emit[Emit calls_total + limit/period gauges]
199
199
  Emit --> Act{rule.action}
200
200
  Act -->|":log<br/>(non-terminating)"| Iter
201
- Act -->|:block or :allow| Return([Return Result])
201
+ Act -->|:block| Return([Return Result])
202
202
  Iter -->|no more rules| Unmatched[Emit calls_total<br/>rule=unmatched, action=allow]
203
203
  Unmatched --> ReturnUnmatched([Return matched=false<br/>action=:allow])
204
204
  Eval -. StandardError .-> Error[Emit errors_total<br/>log warn]
@@ -219,17 +219,12 @@ which never touch Redis:
219
219
  together and the `:log` rule cannot disable the `:block` rule. Note that a
220
220
  pure `:log`-only check still emits one `rule="unmatched"` metric entry
221
221
  because no terminating rule fired.
222
- - `:allow` — when exceeded, `Result#action` is `:allow` (rather than
223
- `:block`). Useful for "always allow this caller even if they're over the
224
- limit" cases while still observing them via metrics. Evaluation terminates
225
- on the first match.
226
222
  - `:skip` — bypass. A matching rule terminates evaluation with
227
223
  `Result#action` `:allow` **without any Redis operation**: nothing is
228
224
  counted, so `limit`, `period`, `characteristics`, and `count_distinct` are
229
225
  inert and the result carries no `info` (`to_response_headers` is `{}`).
230
226
  The match is still observable via `calls_total{action="skip"}`. Use this
231
- for bypasses that don't need a counter; use `:allow` only when you want
232
- the bypassed traffic counted.
227
+ for bypasses.
233
228
 
234
229
  ### Redis keys
235
230
 
@@ -8,9 +8,9 @@ module Labkit
8
8
  # action - the outcome: what the caller should do
9
9
  # :block = rule matched, exceeded, rule configured to block
10
10
  # :log = rule matched, exceeded, rule configured to log only
11
- # :allow = rule matched but count within limit, rule configured to allow,
12
- # rule configured to skip (bypass, nothing counted),
13
- # no rule matched, or error (fail-open)
11
+ # :allow = rule matched but count within limit, rule configured
12
+ # to skip (bypass, nothing counted), no rule matched,
13
+ # or error (fail-open)
14
14
  # The rule's configured action is available via rule.action.
15
15
  # rule - the matched Rule object (nil when matched? is false)
16
16
  # error? - true if Redis was unavailable; result fails open (exceeded? is false)
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Labkit
4
4
  module RateLimit
5
- KNOWN_ACTIONS = %i[block log allow skip].freeze
5
+ KNOWN_ACTIONS = %i[block log skip].freeze
6
6
  RULE_NAME_PATTERN = /\A[a-z0-9_]+\z/
7
7
  RULE_NAME_MAX_LENGTH = 64
8
8
 
@@ -13,9 +13,7 @@ module Labkit
13
13
  # limit - request threshold; may be a callable (resolved per check)
14
14
  # period - window in seconds; may be a callable (resolved per check)
15
15
  # action - :block (enforce), :log (count and log only, do not block,
16
- # evaluation continues to subsequent rules), :allow
17
- # (count but always permit; terminates evaluation on match
18
- # regardless of whether the limit was exceeded), or :skip
16
+ # evaluation continues to subsequent rules), or :skip
19
17
  # (bypass: permit and terminate evaluation on match without
20
18
  # counting; performs no Redis operation, so limit, period,
21
19
  # characteristics, and count_distinct are inert)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gitlab-labkit
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.8.1
4
+ version: 3.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Newdigate