Skip to content

Add count#65

Open
danielmaclaren wants to merge 5 commits intomainfrom
bluesky_52
Open

Add count#65
danielmaclaren wants to merge 5 commits intomainfrom
bluesky_52

Conversation

@danielmaclaren
Copy link
Copy Markdown

Jack and I's 'Count' function for data streaming rate

danielmaclaren and others added 2 commits April 7, 2026 16:13
Co-authored-by: Jack Harper <rerpha@users.noreply.github.com>
@rerpha rerpha changed the title Bluesky 52 Add count Apr 7, 2026
@rerpha rerpha requested a review from Tom-Willemsen April 7, 2026 15:24
Copy link
Copy Markdown
Member

@Tom-Willemsen Tom-Willemsen left a comment

Choose a reason for hiding this comment

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

Haven't functionally reviewed yet but looks like it should work.

A few nit-pick comments...

Comment thread src/count.rs Outdated
let mut bytes_this_second: usize = 0;
let mut total_bytes: usize = 0;
let mut stream = consumer.stream();
let mut interval = time::interval(Duration::from_secs(1));
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.

I think it makes sense for this to be configurable (i.e. passed in through command-line flags)

Comment thread src/count.rs Outdated
Comment thread src/count.rs Outdated
Comment thread src/count.rs
pub async fn count(topic: BrokerAndTopic) {
let consumer: StreamConsumer<DefaultConsumerContext> = ClientConfig::new()
.set("group.id", Uuid::new_v4().to_string())
.set("bootstrap.servers", topic.broker())
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 should provide some way to pass extra parameters here - either as command line args, in a config file, in env variables, whatever.

Probably extra command line args is easiest.

I'd rather not have to recompile if it turns out we need to specify a queue size or something.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

we'll do this separately for all commands as part of #14

Comment thread src/count.rs Outdated
@rerpha rerpha requested a review from Tom-Willemsen April 15, 2026 12:59
Comment thread src/count.rs
}
_ = interval.tick() => {
println!("{:.5} Mbit/s (since program start: average {:.5} Mbit/s, {:.5} MB total)",
bytes_this_second as f64/125000.0,
Copy link
Copy Markdown
Member

@Tom-Willemsen Tom-Willemsen Apr 15, 2026

Choose a reason for hiding this comment

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

This is only true if interval is 1.

Streaming at ~190 mbit/s with --interval 5:

985.75168 Mbit/s (since program start: average 189.82563 Mbit/s, 9609.95335 MB total)

bytes_this_second needs dividing by interval to be correct here

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants