-
Notifications
You must be signed in to change notification settings - Fork 773
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
Adds ability to specify sanitizeOptions for prometheus metrics #3170
Adds ability to specify sanitizeOptions for prometheus metrics #3170
Conversation
func (s SanitizeRange) toTally() (tally.SanitizeRange, error) { | ||
startRangeRunes := []rune(s.StartRange) | ||
if len(startRangeRunes) != 1 { | ||
return tally.SanitizeRange{}, fmt.Errorf("start range '%+v' must be a single rune", startRangeRunes) |
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.
does this give enough feedback for someone using something that looks like a single character but isn't ala https://en.wikipedia.org/wiki/Combining_character - maybe it does but just want to bring it up.
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 the definition of a rune should make that clear as it maps to a Unicode Code Point
return tally.SanitizeRange{}, fmt.Errorf("end range '%+v' must be a single rune", endRangeRunes) | ||
} | ||
|
||
return tally.SanitizeRange([2]rune{startRangeRunes[0], endRangeRunes[0]}), nil |
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.
Do we need the 2 in [2]?
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 is the tally-specific type. they take in an array of runes, not a slice
common/metrics/config.go
Outdated
return tally.SanitizeOptions{}, errors.New("invalid nameChars") | ||
} | ||
|
||
tallyKeyChars, err := s.KeyCharacters.toTally() | ||
if err != nil { | ||
return tally.SanitizeOptions{}, errors.New("invalid keyChars") | ||
} | ||
|
||
tallyValueChars, err := s.ValueCharacters.toTally() | ||
if err != nil { | ||
return tally.SanitizeOptions{}, errors.New("invalid valueChars") | ||
} |
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 error should wrap the detailed error.
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.
oops, good catch
…ralio#3170) This PR adds the ability to set specific tally.SanitizeOptions via temporal configuration. If the configuration is not set, we rely on the default that is defined in code. Otherwise, we will generate a tally.SanitizeOptions by parsing the configuration file and converting it to a tally.SanitizeOptions. Because configuration comes in via yaml, all relevant input fields are strings. The code converts the strings to runes and performs length check validations. Any invalid configuration will fail server startup.
…etrics (#3170) (#3174) Adds ability to specify sanitizeOptions for prometheus metrics (#3170) This PR adds the ability to set specific tally.SanitizeOptions via temporal configuration. If the configuration is not set, we rely on the default that is defined in code. Otherwise, we will generate a tally.SanitizeOptions by parsing the configuration file and converting it to a tally.SanitizeOptions. Because configuration comes in via yaml, all relevant input fields are strings. The code converts the strings to runes and performs length check validations. Any invalid configuration will fail server startup.
…etrics (#3170) (#3174) Adds ability to specify sanitizeOptions for prometheus metrics (#3170) This PR adds the ability to set specific tally.SanitizeOptions via temporal configuration. If the configuration is not set, we rely on the default that is defined in code. Otherwise, we will generate a tally.SanitizeOptions by parsing the configuration file and converting it to a tally.SanitizeOptions. Because configuration comes in via yaml, all relevant input fields are strings. The code converts the strings to runes and performs length check validations. Any invalid configuration will fail server startup.
…ralio#3170) This PR adds the ability to set specific tally.SanitizeOptions via temporal configuration. If the configuration is not set, we rely on the default that is defined in code. Otherwise, we will generate a tally.SanitizeOptions by parsing the configuration file and converting it to a tally.SanitizeOptions. Because configuration comes in via yaml, all relevant input fields are strings. The code converts the strings to runes and performs length check validations. Any invalid configuration will fail server startup.
This PR adds the ability to set specific tally.SanitizeOptions via temporal configuration. If the configuration is not set, we rely on the default that is defined in code. Otherwise, we will generate a tally.SanitizeOptions by parsing the configuration file and converting it to a tally.SanitizeOptions.
Because configuration comes in via yaml, all relevant input fields are strings. The code converts the strings to runes and performs length check validations. Any invalid configuration will fail server startup.