-
Notifications
You must be signed in to change notification settings - Fork 495
Capture RDKafka Statistics as an internal built-in log #6131
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
Merged
cirego
merged 17 commits into
MaterializeInc:main
from
cirego:chris/system-table-kafka-metrics
Mar 23, 2021
Merged
Changes from 5 commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
93fb82a
Log basic metrics instead of extended statistics
cirego dc50905
Merge branch 'main' into chris/system-table-kafka-metrics
cirego ee80890
Add mz_kafka_statistics built-in log / source
cirego 23c3970
Remove change for debugging
cirego 0388f52
Put consumer in the builtin log name
cirego 8945be4
Tracking kafka consumer statistics now works
cirego f73c6f6
Fixup test_persistence
cirego 045293d
Merge branch 'main' into chris/system-table-kafka-metrics
cirego 9f34b96
Log per-partition kafka consumer metrics
cirego f09fe85
Merge branch 'main' into chris/system-table-kafka-metrics
cirego dbec829
Merge branch 'main' into chris/system-table-kafka-metrics
cirego 3713dbe
Derive default values for stats object
cirego 1c38647
Merge branch 'main' into chris/system-table-kafka-metrics
cirego 77d3c5e
Remove commented out log line
cirego 03a0928
Add lo/hi/ls offsets
cirego d09093e
Fix source id and verify join against mz_source_info
cirego e871578
Add dataflow ID to correctly identify source
cirego File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -625,7 +625,11 @@ struct GlueConsumerContext(SyncActivator); | |
|
|
||
| impl ClientContext for GlueConsumerContext { | ||
| fn stats(&self, statistics: Statistics) { | ||
| info!("Client stats: {:#?}", statistics); | ||
| info!( | ||
| "Client stats: name={}, tx={}, tx_bytes={}, rx={}, rx_bytes={}", | ||
| statistics.name, statistics.tx, statistics.tx_bytes, statistics.rx, statistics.rx_bytes, | ||
| ); | ||
| // info!("Client stats: {:#?}", statistics); | ||
|
||
| } | ||
| } | ||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this probably just wants to a a
KafkaConsumerStatisticsvariant in the existingMaterializedenum! The existing separation for timely and differential logs is because those logs integrate with messages that are already integrated with the timely logging framework. As far as the timely logger is concerned, events generated by librdkafka look identical to events generated by other parts of Materialize, so I think you'll save yourself some trouble if you just combine the two.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the feedback! I'm not sure if you saw the thread on Slack yesterday -- I originally tried adding this to the
Materializedenum for the reasons you stated above. Unfortunately,rdkafkaexpects theGlueConsumerContextto beSend + Sync, prohibiting the ability to pass theLoggerobject into the callback's context. Frank advised that I write a newMPSC Logger, as I'll need to implement one that is bothSend + Syncsafe. By putting this into it's own enum, we won't need to modify theMaterialized Loggerfor messages that it will never see.Do you have thoughts on this? I'd like to keep the implementation simple and coherent with the rest of the codebase. If there's a way to use the
Materialized Loggerin theGlueConsumerContext, I'd be very happy to do that.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, hm, I see. I think I understand what Frank is proposing, and it seems nice and general purpose, but it seems like it will require trudging through quite a bit of pain to implement. Personally I'd do something like this:
Possibly that's a terrible idea for some reason, but seems easy enough just to try out.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Medium term we can also make rust-rdkafka provide access to the stats events on a thread of your choice, which would also sidestep this issue nicely.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That does seem much easier than the route that I was going down -- thank you! I'll give this a shot first thing tomorrow!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You bet! Probably worth pinging Frank or Eli or someone else on integrations to sanity check this. Maybe there's some reason this is crazy that I'm not seeing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mind linking the slack thread, @cirego ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was in the Rust channel. Here's the link to Frank's comment about creating an
Arc<EventLinkArc>class: https://materializeinc.slack.com/archives/CMH6PG4CW/p1615938814067100