Skip to content

Unrecord #134

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Unrecord #134

wants to merge 3 commits into from

Conversation

bogzbonny
Copy link

Copy link
Collaborator

@jonhoo jonhoo left a comment

Choose a reason for hiding this comment

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

Thank you! My guess is that CI will also complain about a change to MSRV, but a slight bump is probably warranted anyway. Main point is that I'd like to split out the lint fixes from the unrecord feature such that they're in separate PRs please.

@@ -228,7 +228,7 @@ fn quantiles<R: BufRead, W: Write>(
// Normally I frown on excessive use of From as it's too "magic", but in the limited confines of
// subcommands, the convenience seems worth it.
#[derive(Debug)]
enum CliError {
pub enum CliError {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm not sure I follow why this was made pub?

@@ -7,7 +7,7 @@ use std::fmt;
pub enum CreationError {
/// Lowest discernible value must be >= 1.
LowIsZero,
/// Lowest discernible value must be <= `u64::max_value() / 2` because the highest value is
/// Lowest discernible value must be <= \x60u64::MAX / 2\x60 because the highest value is
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
/// Lowest discernible value must be <= \x60u64::MAX / 2\x60 because the highest value is
/// Lowest discernible value must be <= `u64::MAX / 2` because the highest value is

Copy link
Collaborator

Choose a reason for hiding this comment

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

You've used this \x60 version in a few places now — could you change all of them back to backtick please?

@@ -850,6 +850,14 @@ impl<T: Counter> Histogram<T> {
self.record_n(value, T::one())
}

/// Unrecord `value` in the histogram, removing from the value's current count.
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'd prefer to do this change in a PR that's separate from all the clippy/lint fixes. Could you split them up please?

fn record_n_inner(&mut self, mut value: u64, count: T, clamp: bool) -> Result<(), RecordError> {
fn record_n_inner(
&mut self,
sub: bool,
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think I'd prefer that we add

enum Op {
  Add,
  Sub,
}

as it will make the callsites a lot easier to vet. For example, it'll read:

self.record_n_inner(Op::Add, value, count, true)

instead of

self.record_n_inner(false, value, count, true)

@@ -91,20 +91,20 @@
//! ends up setting its internal version of StartTime.
//!
//! - Neither StartTime nor BaseTime are present: interval timestamps are interpreted as seconds
//! since the epoch. The first interval's timestamp is stored to the StartTime field.
//! since the epoch. The first interval's timestamp is stored to the StartTime field.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why did the indentation change for all of these lines?

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.

2 participants