New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Authentication]Add authentication metrics #9244
Conversation
/pulsarbot run-failure-checks |
...mon/src/main/java/org/apache/pulsar/broker/authentication/metrics/AuthenticationMetrics.java
Outdated
Show resolved
Hide resolved
...mon/src/main/java/org/apache/pulsar/broker/authentication/metrics/AuthenticationMetrics.java
Outdated
Show resolved
Hide resolved
...mon/src/main/java/org/apache/pulsar/broker/authentication/metrics/AuthenticationMetrics.java
Outdated
Show resolved
Hide resolved
/pulsarbot run-failure-checks |
...mon/src/main/java/org/apache/pulsar/broker/authentication/metrics/AuthenticationMetrics.java
Outdated
Show resolved
Hide resolved
...mon/src/main/java/org/apache/pulsar/broker/authentication/metrics/AuthenticationMetrics.java
Outdated
Show resolved
Hide resolved
...mon/src/main/java/org/apache/pulsar/broker/authentication/metrics/AuthenticationMetrics.java
Outdated
Show resolved
Hide resolved
...mon/src/main/java/org/apache/pulsar/broker/authentication/metrics/AuthenticationMetrics.java
Outdated
Show resolved
Hide resolved
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/BrokerService.java
Outdated
Show resolved
Hide resolved
pulsar-broker/src/test/java/org/apache/pulsar/broker/stats/PrometheusMetricsTest.java
Outdated
Show resolved
Hide resolved
/pulsarbot run-failure-checks |
4 similar comments
/pulsarbot run-failure-checks |
/pulsarbot run-failure-checks |
/pulsarbot run-failure-checks |
/pulsarbot run-failure-checks |
Fix counters and labels name Co-authored-by: lipenghui <penghui@apache.org>
f959cc8
to
7b29e67
Compare
/pulsarbot run-failure-checks |
1 similar comment
/pulsarbot run-failure-checks |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BTW, could you please show me how the AuthenticationMetrics.java
interact with the prometheus metrcis generator? Seems I can find it.
...mon/src/main/java/org/apache/pulsar/broker/authentication/metrics/AuthenticationMetrics.java
Outdated
Show resolved
Hide resolved
Whenever a successful authentication is triggered, the log is stored in the Line 206 in 2071a85
|
/pulsarbot run-failure-checks |
### Motivation Currently, if many clients are failing to authenticate, it might not be clear as to the reason why. For JWT auth for example, it could be because the JWT failed to validate, or that a token is expired. In a busy system, these messages are too noisy to log, so we should instead consider metrics that provide info on successful vs failed auths, as well as auth failure reasons ### Modifications * Implement `AuthenticationMetrics` API that allows for instrumenting auth success, and auth failures, with a Prometheus compatible attribute used to distinguish failure reasons. * Add auth metrics instrument to the `basic auth`, `jwt auth`, `tls auth`, `athenz auth` and `sasl auth`. (cherry picked from commit f89dbb6)
Master Issue: streamnative/platform-epics#217
Motivation
Currently, if many clients are failing to authenticate, it might not be clear as to the reason why. For JWT auth for example, it could be because the JWT failed to validate, or that a token is expired. In a busy system, these messages are too noisy to log, so we should instead consider metrics that provide info on successful vs failed auths, as well as auth failure reasons
Modifications
Implement
AuthenticationMetrics
API that allows for instrumenting auth success, and auth failures, with a Prometheus compatible attribute used to distinguish failure reasons.Add auth metrics instrument to the
basic auth
,jwt auth
,tls auth
,athenz auth
andsasl auth
.Add metric
pulsar_authentication_success_count
with two labelsprovider_name
andauth_method
Add metric
pulsar_authentication_failures_count
with 3 labelsprovider_name
,auth_method
andreason
Verifying this change
This change is already covered by existing tests, such as testAuthMetrics.