Skip to content
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

[feat][misc] PIP-264: Add OpenTelemetry authentication and token metrics #23016

Merged

Conversation

dragosvictor
Copy link
Contributor

PIP-264

Motivation

Adds authentication and token metrics, as currently described here, to the OpenTelemetry pipeline.

Modifications

  • Adds the metrics described in [feat][doc] PIP-264: Add authentication and token metrics reference pulsar-site#937 to the collector runs. These metrics are not tied strictly to the broker, and can be used in other places as well (such as the proxy, for instance).
  • Added override method org.apache.pulsar.broker.authentication.AuthenticationProvider#initialize(org.apache.pulsar.broker.ServiceConfiguration, io.opentelemetry.api.OpenTelemetry), giving the authentication plugin access to the OpenTelemetry instance.
  • Added class org.apache.pulsar.broker.authentication.AuthenticationProviderBase, used to initialize and maintain the AuthenticationMetrics object. This class can be further used by the providers, simplifying development.
  • Removed unused static method AuthenticationMetrics.authenticateSuccess

Verifying this change

  • Make sure that the change passes the CI checks.

This change added tests and can be verified as follows:

  • Added test class org.apache.pulsar.broker.stats.OpenTelemetryAuthenticationStatsTest covering the new metrics

Does this pull request potentially affect one of the following parts:

Documentation

Matching PR in forked repository

PR in forked repository: dragosvictor#22

@github-actions github-actions bot added the doc-required Your PR changes impact docs and you will update later. label Jul 9, 2024
@dragosvictor dragosvictor marked this pull request as ready for review July 9, 2024 05:08
@dragosvictor dragosvictor force-pushed the dmisca-pip-264-authentication-metrics branch from 0758b2f to c947325 Compare July 9, 2024 17:47
@merlimat merlimat added this to the 4.0.0 milestone Aug 20, 2024
Copy link
Member

@lhotari lhotari left a comment

Choose a reason for hiding this comment

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

LGTM. Good work @dragosvictor

@dragosvictor
Copy link
Contributor Author

/pulsarbot rerun-failure-checks

@codecov-commenter
Copy link

codecov-commenter commented Aug 28, 2024

Codecov Report

Attention: Patch coverage is 79.55801% with 37 lines in your changes missing coverage. Please review.

Project coverage is 74.50%. Comparing base (bbc6224) to head (1be6157).
Report is 552 commits behind head on master.

Files with missing lines Patch % Lines
...ker/authentication/AuthenticationProviderList.java 40.00% 9 Missing ⚠️
...e/pulsar/broker/authentication/oidc/JwksCache.java 27.27% 8 Missing ⚠️
...thentication/oidc/OpenIDProviderMetadataCache.java 60.00% 4 Missing ⚠️
...r/authentication/AuthenticationProviderAthenz.java 75.00% 2 Missing ⚠️
...hentication/oidc/AuthenticationProviderOpenID.java 80.00% 2 Missing ⚠️
...ker/authentication/AuthenticationProviderSasl.java 33.33% 2 Missing ⚠️
...er/authentication/AuthenticationProviderBasic.java 75.00% 2 Missing ⚠️
...oker/authentication/AuthenticationProviderTls.java 71.42% 2 Missing ⚠️
.../authentication/metrics/AuthenticationMetrics.java 93.33% 2 Missing ⚠️
...entication/metrics/AuthenticationMetricsToken.java 96.07% 1 Missing and 1 partial ⚠️
... and 2 more
Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff              @@
##             master   #23016      +/-   ##
============================================
+ Coverage     73.57%   74.50%   +0.92%     
- Complexity    32624    33721    +1097     
============================================
  Files          1877     1924      +47     
  Lines        139502   144883    +5381     
  Branches      15299    15843     +544     
============================================
+ Hits         102638   107940    +5302     
+ Misses        28908    28681     -227     
- Partials       7956     8262     +306     
Flag Coverage Δ
inttests 27.96% <3.46%> (+3.38%) ⬆️
systests 24.65% <3.46%> (+0.33%) ⬆️
unittests 73.85% <79.55%> (+1.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...r/broker/authentication/AuthenticationService.java 74.77% <100.00%> (+1.44%) ⬆️
...rg/apache/pulsar/broker/service/BrokerService.java 81.80% <100.00%> (+1.02%) ⬆️
...pulsar/broker/stats/PulsarBrokerOpenTelemetry.java 100.00% <100.00%> (+9.09%) ⬆️
.../broker/authentication/AuthenticationProvider.java 67.85% <83.33%> (-4.88%) ⬇️
...er/authentication/AuthenticationProviderToken.java 90.90% <90.90%> (-1.45%) ⬇️
...r/authentication/AuthenticationProviderAthenz.java 68.83% <75.00%> (+0.25%) ⬆️
...hentication/oidc/AuthenticationProviderOpenID.java 75.13% <80.00%> (-1.67%) ⬇️
...ker/authentication/AuthenticationProviderSasl.java 59.39% <33.33%> (-0.61%) ⬇️
...er/authentication/AuthenticationProviderBasic.java 60.00% <75.00%> (+0.90%) ⬆️
...oker/authentication/AuthenticationProviderTls.java 80.55% <71.42%> (-2.78%) ⬇️
... and 5 more

... and 537 files with indirect coverage changes

@lhotari lhotari merged commit 587af85 into apache:master Aug 29, 2024
50 of 51 checks passed
@dragosvictor dragosvictor deleted the dmisca-pip-264-authentication-metrics branch August 30, 2024 17:05
grssam pushed a commit to grssam/pulsar that referenced this pull request Sep 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
doc-required Your PR changes impact docs and you will update later. ready-to-test
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants