pulsar icon indicating copy to clipboard operation
pulsar copied to clipboard

[feat][broker] Expose pulsar out bytes and message metrics per topic

Open pgier opened this issue 3 years ago • 5 comments

Add prometheus metrics which expose the per topic messages out and bytes out total on a per topic basis. Currently, only the subscription level stats are enabled.

Motivation

There are currently two metrics pulsar_out_bytes_total and pulsar_out_messages_total. The metrics represent the pulsar stats on a per subscription basis. It would be convenient to be able to see the summary of these values per topic similar to the stats exposed by pulsar-admin.

Modifications

Added the two metrics and updated the test to verify that the output is correct.

Verifying this change

  • [X] Make sure that the change passes the CI checks.

This change is already covered by existing tests, such as (please describe tests). I made an enhancement to the existing Promtheus metrics test.

Does this pull request potentially affect one of the following parts:

If the box was checked, please highlight the changes

  • [ ] 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
  • [ ] Anything that affects deployment

Documentation

  • [ ] doc
  • [ ] doc-required
  • [X] doc-not-needed
  • [ ] doc-complete

Matching PR in forked repository

PR in forked repository: https://github.com/pgier/pulsar/pull/1

pgier avatar Nov 12 '22 17:11 pgier

Codecov Report

Merging #18440 (94dc7df) into master (fdf86d3) will decrease coverage by 1.64%. The diff coverage is 0.00%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master   #18440      +/-   ##
============================================
- Coverage     45.67%   44.03%   -1.64%     
- Complexity    10075    18476    +8401     
============================================
  Files           693     1791    +1098     
  Lines         67940   155298   +87358     
  Branches       7273    19054   +11781     
============================================
+ Hits          31030    68392   +37362     
- Misses        33333    79241   +45908     
- Partials       3577     7665    +4088     
Flag Coverage Δ
inttests 23.40% <0.00%> (?)
systests 24.13% <0.00%> (?)
unittests 42.86% <0.00%> (-2.82%) :arrow_down:

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...che/pulsar/broker/stats/prometheus/TopicStats.java 10.59% <0.00%> (+10.59%) :arrow_up:

... and 1461 files with indirect coverage changes

codecov-commenter avatar Nov 25 '22 12:11 codecov-commenter

The pr had no activity for 30 days, mark with Stale label.

github-actions[bot] avatar Dec 26 '22 01:12 github-actions[bot]

/pulsarbot run-failure-checks

RobertIndie avatar Apr 11 '23 02:04 RobertIndie

@pgier there's a test failure: https://github.com/apache/pulsar/actions/runs/4664751844/jobs/8257572250?pr=18440#step:11:1521 Can you check ?

cbornet avatar Apr 11 '23 15:04 cbornet

The pr had no activity for 30 days, mark with Stale label.

github-actions[bot] avatar May 13 '23 01:05 github-actions[bot]