Remove unnecessary panic#40
Open
rkuska wants to merge 1 commit into
Open
Conversation
This is a breaking change as it changes the signature of prometheus factory but it removes unnecessary panic in the code. Previously the function changed was defined with variadic parameter for additional list of metrics just to make the additional list optional. This can be done also by using a variadic parameter where each metric is passed on its own. This should be also preferred as user is not forced to create a slice when passing a parameter. We also use the existing lengths to pre-calculate the capacity of the final list of metrics.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Hey there, hope you don't mind a PR. I was checking the code as I am considering using it in my project and I noticed a panic in it. I therefore decided to remove it and it seems like this change should keep the functionality as it was before - but changing the function signature. It would require a bump in major version of the module. Feel free to close this if you think it is too intrusive. Commit message follows.