You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by te...@apache.org on 2023/02/08 07:51:03 UTC
[pulsar] branch branch-2.11 updated: [Improve][Auth]Update authentication failed metrics report (#17787)
This is an automated email from the ASF dual-hosted git repository.
technoboy pushed a commit to branch branch-2.11
in repository https://gitbox.apache.org/repos/asf/pulsar.git
The following commit(s) were added to refs/heads/branch-2.11 by this push:
new 5c47e42308a [Improve][Auth]Update authentication failed metrics report (#17787)
5c47e42308a is described below
commit 5c47e42308ab81a489e322c42649c40d45c21687
Author: Guangning E <gu...@streamnative.io>
AuthorDate: Mon Sep 26 13:02:08 2022 +0800
[Improve][Auth]Update authentication failed metrics report (#17787)
---
.../pulsar/broker/authentication/AuthenticationProviderList.java | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/pulsar-broker-common/src/main/java/org/apache/pulsar/broker/authentication/AuthenticationProviderList.java b/pulsar-broker-common/src/main/java/org/apache/pulsar/broker/authentication/AuthenticationProviderList.java
index c7a0387b667..f921a6f1e09 100644
--- a/pulsar-broker-common/src/main/java/org/apache/pulsar/broker/authentication/AuthenticationProviderList.java
+++ b/pulsar-broker-common/src/main/java/org/apache/pulsar/broker/authentication/AuthenticationProviderList.java
@@ -28,6 +28,7 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import lombok.extern.slf4j.Slf4j;
import org.apache.pulsar.broker.ServiceConfiguration;
+import org.apache.pulsar.broker.authentication.metrics.AuthenticationMetrics;
import org.apache.pulsar.common.api.AuthData;
/**
@@ -58,8 +59,15 @@ public class AuthenticationProviderList implements AuthenticationProvider {
}
if (null == authenticationException) {
+ AuthenticationMetrics.authenticateFailure(
+ AuthenticationProviderList.class.getSimpleName(),
+ "authentication-provider-list", "Authentication required");
throw new AuthenticationException("Authentication required");
} else {
+ AuthenticationMetrics.authenticateFailure(AuthenticationProviderList.class.getSimpleName(),
+ "authentication-provider-list",
+ authenticationException.getMessage() != null
+ ? authenticationException.getMessage() : "Authentication required");
throw authenticationException;
}