Skip to content

P04: Port operational metrics to ZooKeeper 3.8.7 - #180

Merged
bellatrix007 merged 1 commit into
adbansal/zk-387-p03-aclfrom
adbansal/zk-387-p04-metrics
Dec 3, 2026
Merged

bellatrix007 merged 1 commit into
adbansal/zk-387-p03-aclfrom
adbansal/zk-387-p04-metrics

Conversation

@bellatrix007

@bellatrix007 bellatrix007 commented Nov 18, 2026 •

Copy link
Copy Markdown

Description

Port P04 above #177: operational request, connection and session metrics, connection auth_info, and authentication-failure address context.

  • Reconcile final branch-3.6 (9d245933) with seed Add various operational metrics #134. The unified-port counters added by Adding zk server metrics to track connections on unified client port. #79 and removed again by Adding authinfo in connection info metrics #80 are not reintroduced.
  • ZooKeeperServerMXBean adds long attributes: Read/WriteRequestCount, Min/Avg/Max{Read,Write}RequestLatency (ms), and Connection/Session{Create,Close}Count. Names, read/write opcode sets, read-only multi handling and reset behavior follow the fork. Existing metric names are unchanged; stat_reset and MBean resetStatistics also reset the new counters.
  • Admin connections/stat connection objects include auth_info. Admin stat_reset also resets leader proposal statistics, matching four-letter srst. Netty TLS handshake/authentication failure logs include the remote address.
  • 3.8.7 corrections to the fork logic:
    • Ping and createSession record one latency sample, not two.
    • A throttled or failed multi without sub-results no longer throws NullPointerException.
    • A connection close is counted only when an established connection is removed. Repeated Netty closes and rejected TLS connections are not counted.
  • The redundant synchronized (ipMap) around ConcurrentHashMap.compute is not carried.

Identity visibility: The additive auth_info field preserves identities as stored by each provider, including digest identities in user:<hash> form. These values are visible to clients able to run AdminServer connections/stat; endpoint access should be restricted. This is inherited output behavior, not a change to authentication or password hashing.

Tests

  • New or extended cases: ServerStatsTest, FinalRequestProcessorTest, NettyServerCnxnTest, SessionTest, CommandsTest, StatResetCommandTest, X509AuthFailureTest, and new RequestMetricsJmxTest, which reads attributes through the MBean server.
  • Focused red runs against the literal fork logic reproduced the double latency sample, both NullPointerExceptions and the inflated close counts (one established connection versus 40 counted closes after TLS rejections). The same cases pass with this change.
  • clean verify at 2592a45b passed 139 tests per JDK (8/11/17), 417 total, with no failures, errors or skips: 27 baseline + 10 new/extended P04 cases + 102 existing connection, admin, JMX, Netty/TLS and X509/ACL regression cases.
  • Java 11 assembly, RAT, Checkstyle and SpotBugs passed.
  • Tests used process-local -Djava.net.preferIPv4Stack=true. IPv6 remains unqualified. Testing was local macOS ARM64 only, without full-suite, Linux or mixed-version qualification.
  • Local code review completed

Changes that Break Backward Compatibility (Optional)

No existing API or metric names are removed or renamed. Compared with the source fork, ping/createSession latency is recorded once rather than twice, and ConnectionCloseCount counts each established connection once rather than every cleanup invocation. Consumers comparing these metrics across versions may observe lower sample or close counts, and aggregate latency values may differ because duplicate samples are removed.

Documentation (Optional)

JMX attribute reference and admin command notes in zookeeperAdmin.md.

🤖 Generated with GitHub Copilot CLI

@bellatrix007
bellatrix007 force-pushed the adbansal/zk-387-p04-metrics branch from 2592a45 to a799e87 Compare November 27, 2026 06:10
Add the ZooKeeperServer MBean read/write request counts and latencies,
connection and session create/close counts, connection auth_info in
admin connection output, remote addresses in TLS authentication failure
logs, and leader proposal-statistics reset for the admin stat_reset
command.

Record each ping and createSession latency once, tolerate multi requests
without sub-results (throttled or failed), and count a connection close
only when an established connection is removed, so repeated closes and
rejected TLS connections are not counted.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@bellatrix007
bellatrix007 force-pushed the adbansal/zk-387-p04-metrics branch from a799e87 to e863f4d Compare November 27, 2026 08:26
@bellatrix007 bellatrix007 added the upgrade-3.8.x Port of LinkedIn patches onto Apache ZooKeeper 3.8.x label Dec 2, 2026

@arkmish arkmish left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

LGTM. Thanks for addressing the comments.

@bellatrix007
bellatrix007 merged commit 571d10b into li-dev/base-3.8.7 Dec 3, 2026
24 checks passed
@bellatrix007
bellatrix007 deleted the adbansal/zk-387-p04-metrics branch December 3, 2026 09:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

upgrade-3.8.x Port of LinkedIn patches onto Apache ZooKeeper 3.8.x

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants