From commits-return-10977-archive-asf-public=cust-asf.ponee.io@kafka.apache.org Wed Jan 9 18:32:27 2019 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id 2BB66180669 for ; Wed, 9 Jan 2019 18:32:27 +0100 (CET) Received: (qmail 38501 invoked by uid 500); 9 Jan 2019 17:32:26 -0000 Mailing-List: contact commits-help@kafka.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@kafka.apache.org Delivered-To: mailing list commits@kafka.apache.org Received: (qmail 38492 invoked by uid 99); 9 Jan 2019 17:32:26 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 09 Jan 2019 17:32:26 +0000 Received: by gitbox.apache.org (ASF Mail Server at gitbox.apache.org, from userid 33) id 86D2885BFB; Wed, 9 Jan 2019 17:32:25 +0000 (UTC) Date: Wed, 09 Jan 2019 17:32:23 +0000 To: "commits@kafka.apache.org" Subject: [kafka] branch trunk updated: MINOR: Log successful/failed authentications with socket information (#5856) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Message-ID: <154705514096.4088.18316678634803414426@gitbox.apache.org> From: ijuma@apache.org X-Git-Host: gitbox.apache.org X-Git-Repo: kafka X-Git-Refname: refs/heads/trunk X-Git-Reftype: branch X-Git-Oldrev: 1c7bf4e4976e2b58826f68f1abe8ffc9fd41692c X-Git-Newrev: 66a9416e384fa3d3388de65885d895335e707286 X-Git-Rev: 66a9416e384fa3d3388de65885d895335e707286 X-Git-NotificationType: ref_changed_plus_diff X-Git-Multimail-Version: 1.5.dev Auto-Submitted: auto-generated This is an automated email from the ASF dual-hosted git repository. ijuma pushed a commit to branch trunk in repository https://gitbox.apache.org/repos/asf/kafka.git The following commit(s) were added to refs/heads/trunk by this push: new 66a9416 MINOR: Log successful/failed authentications with socket information (#5856) 66a9416 is described below commit 66a9416e384fa3d3388de65885d895335e707286 Author: Stanislav Kozlovski AuthorDate: Wed Jan 9 19:32:02 2019 +0200 MINOR: Log successful/failed authentications with socket information (#5856) Use `info` for failed authentications and `debug` for successful ones. Reviewers: Rajini Sivaram , Ismael Juma --- .../org/apache/kafka/common/network/Selector.java | 28 ++++++++++++++-------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/clients/src/main/java/org/apache/kafka/common/network/Selector.java b/clients/src/main/java/org/apache/kafka/common/network/Selector.java index 8c46746..7a4dd1b 100644 --- a/clients/src/main/java/org/apache/kafka/common/network/Selector.java +++ b/clients/src/main/java/org/apache/kafka/common/network/Selector.java @@ -536,27 +536,35 @@ public class Selector implements Selectable, AutoCloseable { try { channel.prepare(); } catch (AuthenticationException e) { - if (channel.successfulAuthentications() == 0) - sensors.failedAuthentication.record(); - else + boolean isReauthentication = channel.successfulAuthentications() > 0; + if (isReauthentication) sensors.failedReauthentication.record(); + else + sensors.failedAuthentication.record(); + log.info("Address {} failed {}authentication ({})", + channel.socketDescription(), + isReauthentication ? "re-" : "", + e.getClass().getName()); throw e; } if (channel.ready()) { long readyTimeMs = time.milliseconds(); - if (channel.successfulAuthentications() == 1) { - sensors.successfulAuthentication.record(1.0, readyTimeMs); - if (!channel.connectedClientSupportsReauthentication()) - sensors.successfulAuthenticationNoReauth.record(1.0, readyTimeMs); - } else { + boolean isReauthentication = channel.successfulAuthentications() > 1; + if (isReauthentication) { sensors.successfulReauthentication.record(1.0, readyTimeMs); if (channel.reauthenticationLatencyMs() == null) log.warn( - "Should never happen: re-authentication latency for a re-authenticated channel was null; continuing..."); + "Should never happen: re-authentication latency for a re-authenticated channel was null; continuing..."); else sensors.reauthenticationLatency - .record(channel.reauthenticationLatencyMs().doubleValue(), readyTimeMs); + .record(channel.reauthenticationLatencyMs().doubleValue(), readyTimeMs); + } else { + sensors.successfulAuthentication.record(1.0, readyTimeMs); + if (!channel.connectedClientSupportsReauthentication()) + sensors.successfulAuthenticationNoReauth.record(1.0, readyTimeMs); } + log.debug("Address {} successfully {}authenticated", + channel.socketDescription(), isReauthentication ? "re-" : ""); } List responsesReceivedDuringReauthentication = channel .getAndClearResponsesReceivedDuringReauthentication();