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

Add counter:reset method #288

Merged
merged 1 commit into from
Aug 25, 2021
Merged

Add counter:reset method #288

merged 1 commit into from
Aug 25, 2021

Conversation

yngvar-antonsson
Copy link
Collaborator

@yngvar-antonsson yngvar-antonsson commented Aug 16, 2021

I didn't forget about

  • Tests
  • Changelog
  • Documentation (README and rst)

Close #260

Copy link
Member

@DifferentialOrange DifferentialOrange left a comment

Choose a reason for hiding this comment

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

PR's missing changelog and doc edits

@@ -9,4 +9,8 @@ function Counter:inc(num, label_pairs)
Shared.inc(self, num, label_pairs)
end

function Counter:reset(label_pairs)
Copy link
Member

Choose a reason for hiding this comment

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

The original request was about counter initialization. Initialization with counter:reset(label_pairs) seems kinda weird. How about adding an alias for reset as a little syntactic sugar?

Counter.initialize = reset

Copy link
Contributor

Choose a reason for hiding this comment

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

init / reinit / reset, who cares. Reset is better than inc(0), and that's the purpose.

Copy link
Contributor

Choose a reason for hiding this comment

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

Init which resets the value may be considered weird too.

@yngvar-antonsson yngvar-antonsson force-pushed the collector-reset branch 2 times, most recently from 85ddf9d to 762ef62 Compare August 19, 2021 09:24
Copy link
Member

@DifferentialOrange DifferentialOrange left a comment

Choose a reason for hiding this comment

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

Well, I'm still prefer having both init and reset, but if you're against it, let's at least add the functionality

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.

Counter initialization
3 participants