-
-
Notifications
You must be signed in to change notification settings - Fork 2
ref: use Duration for flush_interval #55
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
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
ec38ca8
ref: use Duration for flush_interval
Litarnus 50155c5
lint
Litarnus d8bf663
add custom deserializer using humantime
Litarnus 12a745f
add feature flag guard
Litarnus caef14c
rename visitor struct
Litarnus 75a7cf5
fix typo
Litarnus c26c1b6
interpret flush interval as milliseconds
Litarnus d024b19
trailing comma
Litarnus File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this have a custom deserializer so we can still parse e.g.
1into seconds?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes that makes a lot of sense. I added the custom deserializer which defaults plain numbers to seconds (for backwards compatibility) while parsing numbers with unit suffixes using https://docs.rs/humantime/latest/humantime/index.html
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think humantime is too complicated here. why do we want it? does it just happen to align with how Relay represents duration in its config format? we use plain numbers in snuba, for example.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The idea is that we have backwards compatibility by assuming that plain numbers are seconds while providing a possibility to have sub-second intervals.
I added humantime because I didn't want to roll time string parsing myself, but I can also simplify it by allowing seconds or milliseconds only and write the parsing code myself, what do you thing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Relay configures this only in code, so the main concern was backwards compatibility
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess we could to get rid of the units entirely, although I'm not too happy to use floats when it's possible to represent it with integers
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't use "humantime" for any configuration parameters at all, in any YAML file in {snuba, sentry}. rather we use a numeric value and specify the unit as part of the name of the configuration parameter, such as
flush_interval_ms: 1000.I think preserving backwards compat can be done purely with serde primitives and custom deserializers +
alias, but I would also be OK with just making that breaking change. Snuba does not make this kind of thing configurable in the first place, so there are no config files for us to migrate. I don't know about Relay.Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fair point with the new dep, I would still suggest to allow plain numbers (= seconds) or using the
mssuffix to treat it as milliseconds. This should give us enough flexibility without having more dependencies while keeping the parsing code fairly easy. What do you think?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the write up, I will look into adding support for an additional parameter that represents
ms.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After giving it a bit more thought I decided to introduce the breaking change for the sake of simplicity