-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
remove duplicated broker prometheus metrics type (#8995)
### Motivation If there are multiple topics from different namespaces, the broker prometheus metrics will print out duplicated `# TYPE` definition for pulsar_ml_AddEntryBytesRate and other managed ledger metrics. In fact, this problem can be verified by `promtool` https://github.com/prometheus/prometheus#building-from-source On the broker, run this command to check validity of Pulsar broker metric format. `curl localhost:8080/metrics/ | ~/go/bin/promtool check metrics` ### Modifications To prevent duplicated metrics type definition, the definition is now tracked and only printed out once. It leverages the existing metrics name Set already defined under parseMetricsToPrometheusMetrics() in PrometheusMetricsGenerator.java ### Verifying this change - [ x] Make sure that the change passes the CI checks. This change added tests and can be verified as follows: Added two topics under new namespaces to trigger conditions that duplicated prometheus type could happen previously under testManagedLedgerStats() of PrometheusMetricsTest.java. Updated test cases checks this duplicated type problem. (cherry picked from commit 7319819)
- Loading branch information
1 parent
df884b8
commit 257f60a
Showing
2 changed files
with
58 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters