Skip to content

Conversation

@dobrerazvan
Copy link

@dobrerazvan dobrerazvan commented Jul 18, 2023

Description

Add the flexibility to collect metrics for CG that are in specific states. This allows for less metrics when users create CGs each time the application starts.

Related Issue

Motivation and Context

How Has This Been Tested?

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • I have signed the Adobe Open Source CLA.
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

if len(s.Cfg.ConsumerGroups.ConsumerGroupStates) == 0 {
groupIDs[i] = group.Group
} else {
for _, state := range s.Cfg.ConsumerGroups.ConsumerGroupStates {
Copy link

Choose a reason for hiding this comment

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

instead of iterating through all states can we keep these states in a map and do a O(1) lookup here?

Copy link

@amuraru amuraru left a comment

Choose a reason for hiding this comment

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

see minor review comments

Comment on lines 26 to 30
// create a map for faster lookup
groupStatesMap := make(map[string]string, len(s.Cfg.ConsumerGroups.AllowedConsumerGroupStates))
for _, state := range s.Cfg.ConsumerGroups.AllowedConsumerGroupStates {
groupStatesMap[state] = state
}
Copy link

Choose a reason for hiding this comment

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

@dobrerazvan dobrerazvan force-pushed the dobre/ignore_empty_consumer_groups branch from 06bc6e9 to 11eedc3 Compare July 19, 2023 10:09
@dobrerazvan dobrerazvan merged commit 0e82c7c into main Jul 24, 2023
@dobrerazvan dobrerazvan deleted the dobre/ignore_empty_consumer_groups branch July 24, 2023 12:38
amuraru added a commit that referenced this pull request Sep 13, 2025
* Filter empty consumer groups

* Collect metrics for a set of CG states

* Update minion/config_consumer_group.go

Co-authored-by: Adrian Muraru <[email protected]>

* Implement review

* Implement review

* Update the CG state values

---------

Co-authored-by: Adrian Muraru <[email protected]>
amuraru added a commit that referenced this pull request Oct 15, 2025
* Filter empty consumer groups

* Collect metrics for a set of CG states

* Update minion/config_consumer_group.go

Co-authored-by: Adrian Muraru <[email protected]>

* Implement review

* Implement review

* Update the CG state values

---------

Co-authored-by: Adrian Muraru <[email protected]>
amuraru added a commit that referenced this pull request Oct 16, 2025
* Filter empty consumer groups

* Collect metrics for a set of CG states

* Update minion/config_consumer_group.go

Co-authored-by: Adrian Muraru <[email protected]>

* Implement review

* Implement review

* Update the CG state values

---------

Co-authored-by: Adrian Muraru <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants