Skip to content

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
merged 17 commits into from
Mar 23, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/dataflow/src/logging/materialized.rs
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ pub fn construct<A: Allocate>(
move |((consumer_name, source_id, partition_id), diff_vector)| {
row_packer.pack(&[
Datum::String(&consumer_name),
Datum::String(&source_id.to_string()),
Datum::String(&source_id.source_id.to_string()),
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure if this is correct now, I think that you need both source_id and dataflow_id to uniquely identify these metrics?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh, you're right! I just pushed a fix for this.

Datum::String(&partition_id),
Datum::Int64(diff_vector[0]),
Datum::Int64(diff_vector[1]),
Expand Down
12 changes: 12 additions & 0 deletions test/testdrive/kafka-stats.td
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,18 @@ b sum
> SELECT count(*) FROM mz_kafka_consumer_statistics where consumer_lag = 0
1

# If we change the message encoding and/or the broker version, these results may change
> SELECT partition_id, rx_msgs, rx_bytes, tx_msgs, tx_bytes, lo_offset, hi_offset, ls_offset, app_offset, consumer_lag FROM mz_kafka_consumer_statistics;
partition_id rx_msgs rx_bytes tx_msgs tx_bytes lo_offset hi_offset ls_offset app_offset consumer_lag
-------------------------------------------------------------------------------------------------------------
0 4 28 0 0 0 4 4 4 0

# Verify that we can join against mz_source_info
> SELECT mz_kafka_consumer_statistics.rx_msgs FROM mz_kafka_consumer_statistics INNER JOIN mz_source_info USING (source_id, partition_id) WHERE mz_source_info.source_name like 'kafka-%%';
rx_msgs
-------
4

# Drop the sources and verify that metrics have been removed
> DROP VIEW test1

Expand Down