Skip to content

[improve][broker] Add authorization operation metrics#25512

Open
mattisonchao wants to merge 6 commits intomasterfrom
mattison/authorization-operation-metrics
Open

[improve][broker] Add authorization operation metrics#25512
mattisonchao wants to merge 6 commits intomasterfrom
mattison/authorization-operation-metrics

Conversation

@mattisonchao
Copy link
Copy Markdown
Member

@mattisonchao mattisonchao commented Apr 13, 2026

Motivation

Pulsar already exposes authentication metrics, but it does not expose an equivalent low-cardinality broker metric for authorization outcomes. That makes it hard to alert on authorization denials, compare failures against successful checks, or export equivalent authorization signals through both Prometheus and OpenTelemetry.

Modifications

  • add broker authorization operation metrics with success and failure results
  • expose the metrics through both Prometheus and OpenTelemetry
  • record authorization outcomes centrally in AuthorizationService
  • keep labels low-cardinality by using resource_type, operation, and result
  • add focused tests for Prometheus and OpenTelemetry authorization metrics

Verifying this change

  • ./gradlew --no-configuration-cache :pulsar-broker-common:test --tests org.apache.pulsar.broker.authorization.AuthorizationServiceTest :pulsar-broker:test --tests org.apache.pulsar.broker.stats.OpenTelemetryAuthorizationStatsTest

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
  • The metrics
  • Anything that affects deployment

Documentation

  • doc
  • doc-required
  • doc-not-needed
  • doc-complete

Matching PR in forked repository

PR in forked repository: N/A

Related proposal PR: #25513

@mattisonchao mattisonchao marked this pull request as draft April 13, 2026 10:21
@mattisonchao mattisonchao changed the title Add authorization operation metrics [improve][broker] Add authorization operation metrics Apr 13, 2026
@mattisonchao mattisonchao self-assigned this Apr 13, 2026
@mattisonchao mattisonchao force-pushed the mattison/authorization-operation-metrics branch from f102b10 to 5a2f1fa Compare April 25, 2026 03:27
@mattisonchao mattisonchao marked this pull request as ready for review April 26, 2026 02:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant