Skip to content

[feat][monitor] Add custom topic metric labels to OpenTelemetry metrics attributes#25306

Merged
coderzc merged 5 commits intoapache:masterfrom
coderzc:pip-447-part2
Mar 30, 2026
Merged

[feat][monitor] Add custom topic metric labels to OpenTelemetry metrics attributes#25306
coderzc merged 5 commits intoapache:masterfrom
coderzc:pip-447-part2

Conversation

@coderzc
Copy link
Copy Markdown
Member

@coderzc coderzc commented Mar 10, 2026

Main Issue: N/A

PIP: https://github.com/apache/pulsar/blob/master/pip/pip-447.md

Motivation

This PR is part 2 of PIP-447.

Part 1 for Prometheus labels has already been merged in #24991. This follow-up extends the same custom topic metric label support to OpenTelemetry topic metrics so both metrics pipelines expose the same topic property based labels.

Modifications

  • add custom topic metric labels to OpenTelemetry topic metrics for persistent topics
  • extend PersistentTopicAttributes to build OpenTelemetry attributes with custom labels
  • update OpenTelemetryTopicStats to attach custom labels across topic metrics
  • add broker tests for custom labels in OpenTelemetry metrics
  • fix the renamed config setter in the test after rebasing on latest master

Verifying this change

  • Make sure that the change passes the CI checks.

This change added tests and can be verified as follows:

  • Ran mvn clean install -DskipTests
  • Added OpenTelemetryCustomLabelsTest to verify custom labels are exposed in OpenTelemetry metrics and omitted when the feature is disabled

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: coderzc#51

@coderzc coderzc changed the title [feat][broker] Add custom topic metric labels to OpenTelemetry metrics [feat][monitor] Add custom topic metric labels to OpenTelemetry metrics Mar 10, 2026
@coderzc coderzc added type/feature The PR added a new feature or issue requested a new feature area/metrics labels Mar 10, 2026
@coderzc coderzc changed the title [feat][monitor] Add custom topic metric labels to OpenTelemetry metrics [feat][monitor] Add custom topic metric labels to OpenTelemetry metrics attributes Mar 10, 2026
@github-actions github-actions bot added the doc-not-needed Your PR changes do not impact docs label Mar 10, 2026
@shibd
Copy link
Copy Markdown
Member

shibd commented Mar 16, 2026

/pulsarbot rerun-failure-checks

@coderzc coderzc merged commit 0f1d790 into apache:master Mar 30, 2026
43 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/metrics doc-not-needed Your PR changes do not impact docs ready-to-test type/feature The PR added a new feature or issue requested a new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants