Skip to content

docs(server): explain fractional audit limits - #584

Open
imbajin wants to merge 2 commits into
apache:masterfrom
hugegraph:codex/repair-audit-rate-docs
Open

imbajin wants to merge 2 commits into
apache:masterfrom
hugegraph:codex/repair-audit-rate-docs

Conversation

@imbajin

@imbajin imbajin commented Dec 3, 2026 •

Copy link
Copy Markdown
Member

Purpose

A configured audit rate between zero and one could fail when the per-user limiter was first created. It now allows one audit record per configured interval for each cached user limiter.

Main Changes

  • Document the per-cached-user audit rate and its zero setting.
  • Describe the first fractional permit and the limiter cache lifetime.
  • Update the English and Chinese configuration references.

小于每秒一条的审计日志频率

Verification

Checked the English and Chinese pages locally.

Server PR

- Document the per-cached-user audit rate and its zero setting.
- Describe the first fractional permit and the limiter cache lifetime.
- Update the English and Chinese configuration references.
@imbajin
imbajin marked this pull request as ready for review December 3, 2026 07:26
- Explain the saturated-counter reset in the English option reference.
- Apply the same integer timer wording to the Chinese reference.
- Retain the fractional-rate examples and cache boundary.

@imbajin imbajin left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Score: 6.5/10 · Confidence: high

Blocking: yes

Summary

Fractional audit-rate guidance depends on an unmerged server change and can lead operators to suppress audit output.

Evidence

Apache server master casts the rate to an integer; the linked server fix remains open in a fork.

Validation notes

Source inspection only; no running server test.


At `0`, the authentication proxy emits no audit records. Authentication and authorization continue to run.

For a positive rate below `1`, the first record can be logged immediately. At `0.5`, subsequent records are at least two seconds apart while the user's

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Gate this behavior on the server fix

On current Apache HugeGraph master, RateLimiter.create(double) casts the rate to an integer, so 0.5 becomes zero and audit records are suppressed. The linked server fix is still open in the fork. Publishing this guidance first can cause operators to lose audit output. Please retain the current behavior until the fix reaches Apache, or clearly qualify the applicable server version. This is based on source inspection; I did not run the server.

@bitflicker64 bitflicker64 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Blocking: yes. Summary: Apache master and 1.7.0 truncate auth.audit_log_rate to an integer, so the Chinese fractional-rate paragraph, like the English one already flagged, says 0.5 logs records when it suppresses them all.


设为 `0` 时,鉴权代理不输出审计日志,认证和授权照常执行。

设为大于 `0` 且小于 `1` 的值时,首条记录可立即输出。设为 `0.5` 时,只要用户的限额状态仍在缓存中,后续记录至少间隔两秒。

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Important: on Apache master and 1.7.0, RateLimiter.create casts the rate to int, so 0.5 yields a limit of 0 and no audit record is logged; this paragraph describes the unmerged fork fix. Keep the truncation wording here until that fix lands in apache/hugegraph, or name the server version that adds it.

limiter remains in the cache. The limiter state is held in memory and resets when the cache entry is removed or the Server restarts.

For values of `1` or above, the record limit is the integer part of the rate, capped at `Integer.MAX_VALUE`. For example, `1.9` sets a limit of one record.
The existing timer runs once per second and clears the count only when it has reached the limit. A partial count carries forward.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor: "The existing timer" anchors the doc in time, and the Chinese page repeats it as 原有计时器. Write "A timer" here and 计时器 there.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants