pulsar icon indicating copy to clipboard operation
pulsar copied to clipboard

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

Open dragosvictor opened this issue 1 year ago • 0 comments

PIP-264

Motivation

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

Modifications

  • Adds the metrics described in https://github.com/apache/pulsar-site/pull/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

  • [x] 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:

  • [ ] Dependencies (add or upgrade a dependency)
  • [ ] The public API
  • [ ] The schema
  • [ ] The default values of configurations
  • [ ] The threading model
  • [ ] The binary protocol
  • [ ] The REST endpoints
  • [ ] The admin CLI options
  • [x] The metrics: As described in https://github.com/apache/pulsar-site/pull/937
  • [ ] Anything that affects deployment

Documentation

  • [ ] doc
  • [x] doc-required https://github.com/apache/pulsar-site/pull/937
  • [ ] doc-not-needed
  • [ ] doc-complete

Matching PR in forked repository

PR in forked repository: https://github.com/dragosvictor/pulsar/pull/22

dragosvictor avatar Jul 09 '24 04:07 dragosvictor