Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fix][broker] Fixed reset for AggregatedNamespaceStats #21225

Merged
merged 2 commits into from Sep 24, 2023

Conversation

asafm
Copy link
Contributor

@asafm asafm commented Sep 21, 2023

Motivation

AggregatedNamespaceStats is the object used when topic-level metrics are aggregated into namespace level, specifically when exposeTopicLevelMetricsInPrometheus=false.
There is a loop which runs over all namespaces, and for each one, the same object is used, by first resetting it and then adding each topic metrics to it.
The existing reset() method lacks all fields hence some fields were accumulating over round of metrics reporting to prometheus metrics servlet, good example for it would be pulsar_out_bytes_total.

Modifications

I've fixed AggregatedNamespaceStats.reset() by including all the fields that were missing from it.

Verifying this change

  • Make sure that the change passes the CI checks.

(Please pick either of the following options)

This change added tests and can be verified as follows:

  • Added testReset() method. I may add in subsequent PR a more generic way to validate we never forget to reset an added field.

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

Documentation

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

Matching PR in forked repository

PR in forked repository: asafm#3

@github-actions
Copy link

@asafm Please add the following content to your PR description and select a checkbox:

- [ ] `doc` <!-- Your PR contains doc changes -->
- [ ] `doc-required` <!-- Your PR changes impact docs and you will update later -->
- [ ] `doc-not-needed` <!-- Your PR changes do not impact docs -->
- [ ] `doc-complete` <!-- Docs have been already added -->

@github-actions github-actions bot added doc-not-needed Your PR changes do not impact docs and removed doc-label-missing labels Sep 21, 2023
@codelipenghui codelipenghui added this to the 3.2.0 milestone Sep 21, 2023
Copy link
Contributor

@codelipenghui codelipenghui left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, left some minor comments.

pulsar-broker/pom.xml Outdated Show resolved Hide resolved
pulsar-broker/pom.xml Outdated Show resolved Hide resolved
@codelipenghui
Copy link
Contributor

/pulsarbot run-failure-checks

@codelipenghui
Copy link
Contributor

/pulsarbot run-failure-checks

@codelipenghui codelipenghui merged commit c632431 into apache:master Sep 24, 2023
44 of 45 checks passed
liangyepianzhou pushed a commit that referenced this pull request Sep 25, 2023
@asafm asafm deleted the fix-missing-fields-in-reset-ns branch September 26, 2023 12:13
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.

None yet

7 participants