Skip to content

[feat][broker] Add custom topic metric labels to OpenTelemetry metrics - #51

Open
coderzc wants to merge 1165 commits into
masterfrom
pip-447-part2
Open

[feat][broker] Add custom topic metric labels to OpenTelemetry metrics#51
coderzc wants to merge 1165 commits into
masterfrom
pip-447-part2

Conversation

@coderzc

@coderzc coderzc commented Mar 10, 2026

Copy link
Copy Markdown
Owner

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 apache#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 OpenTelemetry topic stats recording 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: N/A

Dream95 and others added 30 commits October 22, 2025 12:58
…shInOrder (apache#24826)

Signed-off-by: Dream95 <zhou_8621@163.com>
Co-authored-by: Lari Hotari <lhotari@users.noreply.github.com>
apache#24881)

Co-authored-by: Jiwei Guo <jwguo@streamnative.io>
Co-authored-by: Zixuan Liu <nodeces@gmail.com>
…tBacklogQuota handle empty /metrics scrape (apache#24887)

Signed-off-by: Vinkal Chudgar <vinkal.chudgar@gmail.com>
…by synchronizing mock stubbing with CountDownLatch (apache#24875)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Lari Hotari <lhotari@apache.org>
…rs, such as namespace deletion and namespace policies updating (apache#24860)
…gistered (apache#24859)

Signed-off-by: Vinkal Chudgar <vinkal.chudgar@gmail.com>
…ld return latest (apache#24898)

Co-authored-by: fanjianye <fanjianye@bigo.sg>
…Reconnected events to re-register broker metadata (apache#24932)

Signed-off-by: Dream95 <zhou_8621@163.com>
coderzc and others added 25 commits February 12, 2026 11:36
Co-authored-by: Lari Hotari <lhotari@apache.org>
…bilityCheck (apache#25255)

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
)

Co-authored-by: Lari Hotari <lhotari@apache.org>
)

Co-authored-by: Lari Hotari <lhotari@apache.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.