Skip to content

KAFKA-17248 - KIP 1076 implementation - #17021

Merged
bbejeck merged 54 commits into
apache:trunkfrom
bbejeck:kip_1076_implementation
Nov 5, 2024
Merged

bbejeck merged 54 commits into
apache:trunkfrom
bbejeck:kip_1076_implementation

Conversation

@bbejeck

@bbejeck bbejeck commented Aug 27, 2024 •

Copy link
Copy Markdown
Member

Implementation of KIP-1076 to allow for adding client application metrics to the KIP-714 framework

Integration and unit tests forthcoming

Committer Checklist (excluded from commit message)

  • Verify design and implementation
  • Verify test coverage and CI build status
  • Verify documentation (including upgrade notes)

@bbejeck
bbejeck marked this pull request as draft August 27, 2024 22:26
@bbejeck bbejeck added streams kip Requires or implements a KIP KIP-1076 Metrics for client applications KIP-714 extension labels Aug 27, 2024
@bbejeck
bbejeck force-pushed the kip_1076_implementation branch from 4e8ffa7 to d390f0a Compare August 28, 2024 22:11
@bbejeck bbejeck changed the title [WIP NO MERGE] KAFKA-17248 - KIP 1076 implementation KAFKA-17248 - KIP 1076 implementation Sep 2, 2024
@bbejeck
bbejeck force-pushed the kip_1076_implementation branch from 61270fb to b566d34 Compare September 3, 2024 20:27
@bbejeck
bbejeck marked this pull request as ready for review September 3, 2024 20:33
@bbejeck
bbejeck force-pushed the kip_1076_implementation branch from d6f9919 to b96b967 Compare September 4, 2024 16:28
@apoorvmittal10
apoorvmittal10 self-requested a review September 4, 2024 20:23

@apoorvmittal10 apoorvmittal10 left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for the PR @bbejeck. I have taken a pass and some comments.

@bbejeck

bbejeck commented Sep 5, 2024

Copy link
Copy Markdown
Member Author

Thanks for the comments @apoorvmittal10 - I've addressed your comments.

@mjsax mjsax left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Not sure if I understand the end-to-end wiring already, so need to make another pass.

Btw: should we also verify state store metrics (or are they automatically verified as part of task metrics)?

@bbejeck

bbejeck commented Sep 9, 2024

Copy link
Copy Markdown
Member Author

should we also verify state store metrics (or are they automatically verified as part of task metrics)?

They are covered as part of task metrics, but I expanded the test to explicitly verify state store metrics are correct as well

@mjsax mjsax left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for the PR update. Made another pass.

@bbejeck
bbejeck force-pushed the kip_1076_implementation branch from 020d7c4 to 965fd23 Compare September 13, 2024 17:00
@bbejeck

bbejeck commented Sep 13, 2024

Copy link
Copy Markdown
Member Author

@mjsax thanks for the second review, I've addressed your comments

@bbejeck

bbejeck commented Sep 30, 2024 •

Copy link
Copy Markdown
Member Author

@mjsax, @apoorvmittal10, @AndrewJSchofield comments addressed

@AndrewJSchofield AndrewJSchofield left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Just one remaining comment.

@bbejeck

bbejeck commented Oct 1, 2024

Copy link
Copy Markdown
Member Author

@AndrewJSchofield, thanks for the review; I've addressed your comment.

@AndrewJSchofield AndrewJSchofield left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

lgtm

@bbejeck
bbejeck force-pushed the kip_1076_implementation branch from 623cb7b to 21667fe Compare November 2, 2024 16:53
Comment on lines +173 to +178
final List<String> expectedMetrics = streams.metrics().values().stream().map(Metric::metricName)
.filter(metricName -> metricName.tags().containsKey("thread-id")).map(mn -> {
final String name = mn.name().replace('-', '.');
final String group = mn.group().replace("-metrics", "").replace('-', '.');
return "org.apache.kafka." + group + "." + name;
}).sorted().collect(Collectors.toList());

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Needed to convert the metric names into the expected KIP-714 naming format

@bbejeck

ghost commented Nov 2, 2024

Copy link
Copy Markdown
Member Author

@mjsax rebased on trunk - ready for final review


final Uuid mainConsumerInstanceId = clientInstanceIds.consumerInstanceIds().entrySet().stream()
.filter(entry -> !entry.getKey().endsWith("-restore-consumer")
&& !entry.getKey().endsWith("GlobalStreamThread"))

ghost Nov 4, 2024

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We don't use -global-consumer in the key for the global consumer?

This sounds like a bug to me -- checking the code, it seems we use getName() + "-consumer" inside StreamThread while we use getName() only for the global case inside KafkaStreams.

Out of scope for this PR, but I think we should fix it in a follow up PR (given that it is technically a breaking change, we should think about it twice though... But as we head into 4.0, it might be ok -- however, we should call it out in the upgrade docs and we need a Jira for it)

30_000,
"Never received subscribed metrics");
final List<String> actualInstanceMetrics = TelemetryPlugin.SUBSCRIBED_METRICS.get(adminInstanceId);
final List<String> expectedInstanceMetrics = Arrays.asList("org.apache.kafka.stream.alive.stream.threads", "org.apache.kafka.stream.failed.stream.threads");

ghost Nov 4, 2024

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Unrelated, but "alive stream thread" seems to be missing in the docs: https://kafka.apache.org/documentation/#kafka_streams_client_monitoring

Would you be interested to do a follow up PR about it?

ghost left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Only some nits. Overall LGTM. Feel free to merge.

@bbejeck
bbejeck merged commit 4ed0a95 into apache:trunk Nov 5, 2024
@bbejeck

ghost commented Nov 5, 2024

Copy link
Copy Markdown
Member Author

Merged #17021 into trunk

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build Gradle build or GitHub Actions clients consumer core Kafka Broker kip Requires or implements a KIP KIP-1076 Metrics for client applications KIP-714 extension producer streams

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants