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

Start adding farmer metrics. #2358

Merged
merged 6 commits into from
Dec 22, 2023
Merged

Start adding farmer metrics. #2358

merged 6 commits into from
Dec 22, 2023

Conversation

shamil-gadelshin
Copy link
Contributor

This PR adds the audit event and farmer metrics of that event. Relates to autonomys/space-acres#34

This is PoC and will be later extended to other events starting from proving events.

Code contributor checklist:

@shamil-gadelshin shamil-gadelshin added the networking Subspace networking (DSN) label Dec 20, 2023
@shamil-gadelshin shamil-gadelshin self-assigned this Dec 20, 2023
Comment on lines 183 to 190
if let Some(audit_event_handler) = audit_event_handler {
let duration = Instant::now().duration_since(start);
let duration_secs = duration.as_secs_f64();

audit_event_handler.call_simple(&AuditEvent {
duration: duration_secs,
});
}
Copy link
Member

Choose a reason for hiding this comment

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

Since this is happening at the end of the audit_plot_sync call, you might as well surface it to subspace-farmer and not change subspace-farmer-components at all. Ideally we wouldn't need to change anything in this crate.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The proposed change will also include additional time for PoT generation. Please, confirm that you want to measure the audit() call timing instead.

Copy link
Member

Choose a reason for hiding this comment

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

PoT generation is Timekeeper's responsibility, can you clarify what you mean here?

Copy link
Contributor Author

@shamil-gadelshin shamil-gadelshin Dec 21, 2023

Choose a reason for hiding this comment

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

I meant this line: https://github.com/subspace/subspace/blob/f76fb316a42728ff15dc39b00d6475fb910220f7/crates/subspace-farmer/src/single_disk_farm/farming.rs#L170

Should I measure the whole audit() method or just audit_plot_sync() invocation within it?

Copy link
Member

@nazar-pc nazar-pc Dec 21, 2023

Choose a reason for hiding this comment

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

That is PoSpace table. And no, I don't think that is necessary to measure it, that is too detailed just audit_plot_sync.

Copy link
Member

Choose a reason for hiding this comment

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

BTW that callback with table generator is only called when proving is done. I guess it might have been confusing to see it in this file, but it is not actually running just yet.

Copy link
Member

@nazar-pc nazar-pc left a comment

Choose a reason for hiding this comment

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

This is the kind of thing I expected.
Suggested a few improvements to make it a bit better.

crates/subspace-farmer/src/bin/subspace-farmer/utils.rs Outdated Show resolved Hide resolved
crates/subspace-farmer-components/src/auditing.rs Outdated Show resolved Hide resolved
crates/subspace-farmer-components/src/auditing.rs Outdated Show resolved Hide resolved
crates/subspace-farmer/src/bin/subspace-farmer/utils.rs Outdated Show resolved Hide resolved
@nazar-pc nazar-pc removed the networking Subspace networking (DSN) label Dec 20, 2023
# Conflicts:
#	crates/subspace-farmer/src/bin/subspace-farmer/commands/farm.rs
@shamil-gadelshin shamil-gadelshin marked this pull request as ready for review December 22, 2023 10:18
Copy link
Member

@nazar-pc nazar-pc left a comment

Choose a reason for hiding this comment

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

Please revert changes in subspace-farmer-components crate (Cargo.toml and auditing.rs), they are not necessary

Copy link
Member

@nazar-pc nazar-pc left a comment

Choose a reason for hiding this comment

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

Thanks, I'll squash merge once CI passed

@nazar-pc nazar-pc merged commit 969d235 into main Dec 22, 2023
10 checks passed
@nazar-pc nazar-pc deleted the farmer-metrics branch December 22, 2023 12:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging this pull request may close these issues.

2 participants