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

[FLINK-24409][connectors] Fix metrics errors with topics names with periods #17401

Closed
wants to merge 1 commit into from
Closed

[FLINK-24409][connectors] Fix metrics errors with topics names with periods #17401

wants to merge 1 commit into from

Conversation

jherico
Copy link

@jherico jherico commented Oct 1, 2021

What is the purpose of the change

  • Fix the errors generated by the metrics code when reading from a Kafka topic that includes periods in the names. The filter for the metric tries to compare the topic name against the corresponding metric topic tag, but the metric tags execute a transform on the topic name that replaces any periods with underscores, so if you try to find the records-lag metric in via the changed function, it logs a WARN level log with an exception stack trace.

Brief change log

  • Execute the required transformation in the getRecordsLagMetric function

Verifying this change

This change is a trivial rework / code cleanup without any test coverage.

Unfortunately while some of the tests in KafkaSourceReaderTest cover this code and changing the topic name in that class to "Kafka.Source.Reader.Test" even causes the issue, it doesn't actually cause the tests to fail. Further, the KafkaSourceReaderMetricsTest doesn't have any coverage of the getRecordsLagMetric function at all, which is disappointing. I tried to add some coverage but I wasn't successful.

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

  • Dependencies (does it add or upgrade a dependency): no
  • The public API, i.e., is any changed class annotated with @Public(Evolving): no
  • The serializers: no
  • The runtime per-record code paths (performance sensitive): no
  • Anything that affects deployment or recovery: no
  • The S3 file system connector: no

Documentation

  • Does this pull request introduce a new feature? no
  • If yes, how is the feature documented? not applicable

@flinkbot
Copy link
Collaborator

flinkbot commented Oct 1, 2021

Thanks a lot for your contribution to the Apache Flink project. I'm the @flinkbot. I help the community
to review your pull request. We will use this comment to track the progress of the review.

Automated Checks

Last check on commit fd01adb (Fri Oct 01 06:35:44 UTC 2021)

Warnings:

  • No documentation files were touched! Remember to keep the Flink docs up to date!
  • This pull request references an unassigned Jira ticket. According to the code contribution guide, tickets need to be assigned before starting with the implementation work.

Mention the bot in a comment to re-run the automated checks.

Review Progress

  • ❓ 1. The [description] looks good.
  • ❓ 2. There is [consensus] that the contribution should go into to Flink.
  • ❓ 3. Needs [attention] from.
  • ❓ 4. The change fits into the overall [architecture].
  • ❓ 5. Overall code [quality] is good.

Please see the Pull Request Review Guide for a full explanation of the review process.


The Bot is tracking the review progress through labels. Labels are applied according to the order of the review items. For consensus, approval by a Flink committer of PMC member is required Bot commands
The @flinkbot bot supports the following commands:

  • @flinkbot approve description to approve one or more aspects (aspects: description, consensus, architecture and quality)
  • @flinkbot approve all to approve all aspects
  • @flinkbot approve-until architecture to approve everything until architecture
  • @flinkbot attention @username1 [@username2 ..] to require somebody's attention
  • @flinkbot disapprove architecture to remove an approval you gave earlier

@flinkbot
Copy link
Collaborator

flinkbot commented Oct 1, 2021

CI report:

Bot commands The @flinkbot bot supports the following commands:
  • @flinkbot run azure re-run the last Azure build

@AHeise
Copy link
Contributor

AHeise commented Oct 7, 2021

@PatrickRen could you PTAL? I think we should have a test case for record lag metric as well.

Copy link
Contributor

@PatrickRen PatrickRen left a comment

Choose a reason for hiding this comment

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

Thanks @jherico for the patch! This looks good to me. As suggested by @AHeise I think adding a case for testing topic names with period would be better.

@AHeise
Copy link
Contributor

AHeise commented Oct 14, 2021

@PatrickRen could you please give pointers to @jherico on how to approach the test?

@PatrickRen
Copy link
Contributor

Sorry for my late response! @jherico Here's my implementation of the test case that might be helpful. Feel free to cherry-pick it or implement your own.

PatrickRen@7e7f0d4

Another choice is to use parameterized test in JUnit 5 for testing pendingRecords with different topic names including with special characters, but first you need to migrate KafkaPartitionSplitReaderTest to JUnit 5 style. Here's my implementation:

PatrickRen@e17ac77

@MartijnVisser
Copy link
Contributor

@jherico Do you think you could add the tests or do you need some more help?

@jherico
Copy link
Author

jherico commented Nov 10, 2021 via email

@MartijnVisser
Copy link
Contributor

That would be great. There are multiple contributors who would like to help out (it's a bug that we would like to resolve asap) so do let know in case you need any help.

@AHeise
Copy link
Contributor

AHeise commented Nov 11, 2021

Does it make sense to re-assign the task to someone else?

@jherico
Copy link
Author

jherico commented Nov 17, 2021

ok, it's a pretty small change I know, but I'm kind of irked that #17773 appears to include my exact changes but without my actual commit.

@jherico jherico closed this Nov 17, 2021
@fapaul
Copy link

fapaul commented Nov 17, 2021

@jherico sorry that was my fault :( I did not think about when copying your code instead of cherry-picking the commit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
7 participants