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 errors related to filtering based on user-specified consumer groups filters #14406

Merged
merged 15 commits into from
Apr 19, 2023

Conversation

alopezz
Copy link
Contributor

@alopezz alopezz commented Apr 18, 2023

What does this PR do?

It fixes a few errors and cleans up the logic involved in filtering of partitions based on the filters specified in the config.

Motivation

QA (AI-3024).

The main problems found were:

  • We were getting metrics when a consumer group specified consumer_groups didn’t really match any actual consumer groups, which is an unnecessary and unintuitive change in behaviour when compared to previous versions of the integration.
  • When a regex specified in consumer_groups_regex failed to match against a given consumer group, it would skip trying to match the rest of the regexes in that config option for that consumer group.
  • The logic for dealing with the different consumer_groups-based filtering options was inconsistent, even when it didn't result in externally visible behaviour (due to deduplication of metrics in the agent), there could be maintainability and performance concerns.

Additional Notes

Reviewers are advised to look at this PR one commit at a time to follow the individual steps more easily.

Review checklist (to be filled by reviewers)

  • Feature or bugfix MUST have appropriate tests (unit, integration, e2e)
  • PR title must be written as a CHANGELOG entry (see why)
  • Files changes must correspond to the primary purpose of the PR as described in the title (small unrelated changes should have their own PR)
  • PR must have changelog/ and integration/ labels attached
  • If the PR doesn't need to be tested during QA, please add a qa/skip-qa label.

@alopezz alopezz requested a review from a team as a code owner April 18, 2023 14:19
Copy link
Contributor Author

alopezz commented Apr 18, 2023

Current dependencies on/for this PR:

This comment was auto-generated by Graphite.

@alopezz alopezz added changelog/Fixed category/bugfix For use during Agent Release period labels Apr 18, 2023
@alopezz alopezz force-pushed the alopez/kafka-consumer/config-cleanup branch from bee3bee to 6e307dd Compare April 18, 2023 14:36
@alopezz alopezz force-pushed the alopez/kafka-consumer/consumer-groups-fix branch from ccc5f34 to 0c67ed6 Compare April 18, 2023 14:37
Co-authored-by: Ilia Kurenkov <ilia.kurenkov@datadoghq.com>
@codecov
Copy link

codecov bot commented Apr 18, 2023

Codecov Report

Merging #14406 (442f0c3) into master (e40cd40) will increase coverage by 0.16%.
The diff coverage is 95.65%.

Flag Coverage Δ
kafka_consumer 93.43% <95.65%> (+11.63%) ⬆️

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

Copy link
Contributor

@yzhan289 yzhan289 left a comment

Choose a reason for hiding this comment

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

LGTM! Good note about reading commit by commit, definitely helped with understanding. Just 1 non-blocking question.

Base automatically changed from alopez/kafka-consumer/config-cleanup to master April 19, 2023 17:41
@yzhan289 yzhan289 merged commit 85ab590 into master Apr 19, 2023
@yzhan289 yzhan289 deleted the alopez/kafka-consumer/consumer-groups-fix branch April 19, 2023 18:10
steveny91 pushed a commit that referenced this pull request Apr 21, 2023
…ps filters (#14406)

* Add extra test case

* Move consumer group validation to config class

* Move validation of correct consumer group configuration to Config class

Since it's a configuration concern, that's where it seems to belong,
and the behavior would thus be consistent with where other
`ConfigurationError`s are raised.

* Make sure we don't return metrics for consumer groups that don't exist

* Separate partition filtering step

* Separate filtering based on `consumer_groups` to its own function

* Use consistent logic for all the types of filtering

* Separate all filtering to a separate method

* Fix early skip when filtering by regexes

* Change looping order to simplify and avoid unnecessary work

* Simplify filtering functions

* Deduplicate filtered partitions and remove unnecessary option checking

* Rename exact match filtering function to better reflect what it does

* Fix wording on test id

Co-authored-by: Ilia Kurenkov <ilia.kurenkov@datadoghq.com>

---------

Co-authored-by: Ilia Kurenkov <ilia.kurenkov@datadoghq.com>
Co-authored-by: Andrew Zhang <andrew.zhang@datadoghq.com>
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.

3 participants