Uh oh!
There was an error while loading. Please reload this page.
Adding Sanitizer interface and implementation - #70
Conversation
| /** | ||
| * Sanitize returns a sanitized version of the input string value. | ||
| */ | ||
| public interface Sanitize { |
There was a problem hiding this comment.
Please try for a different name. Sanitize next to Sanitizer confused me thoroughly
There was a problem hiding this comment.
The Sanitizer interface matches the uber-go/tallySanitizer interface.
The Sanitize interface is meant to match the uber-go/tallySanitizeFn interface. Name it SanitizeFn too?
There was a problem hiding this comment.
Please elaborate on what this interface is needed for
| // first check if the provided character is valid | ||
| boolean validCurr = | ||
| ranges.stream().anyMatch(range -> ch >= range.low() && ch <= range.high()) |
There was a problem hiding this comment.
is this operation performance-sensitive? If so, this looks very expensive
There was a problem hiding this comment.
It matches the uber-go/tallysanitzeFn(). Like the go version, it optimizes allocations by avoiding copying if the all characters are valid. Any suggestions on how to optimize this in Java?
longquanzheng
commented
Mar 31, 2021
Any progress on this PR? @ravirajj@inetchitailo ? |
longquanzheng
commented
Mar 31, 2021
@SokolAndrey@andrewmains12@alexeykudinkin can you help take a look? I am needing this in my project. Thanks so much |
| return snap; | ||
| } | ||
| private ImmutableMap<String, String> copyAndSanitizeMap(Map<String, String> tags) { |
There was a problem hiding this comment.
Let's avoid copying if there are no changes to the map
| * @param name the name string | ||
| * @return the sanitized name | ||
| */ | ||
| String name(String name); |
There was a problem hiding this comment.
Please follow the naming convention -- method name should bear a verb in it
| /** | ||
| * Sanitize returns a sanitized version of the input string value. | ||
| */ | ||
| public interface Sanitize { |
There was a problem hiding this comment.
Please elaborate on what this interface is needed for
longquanzheng
commented
Apr 4, 2021
@alexeykudinkin@ravirajj Hello, thanks so much for this. Thanks |
alexeykudinkin
commented
Apr 5, 2021
@longquanzheng works for me |
ScopeBulidercan be configured with the standardM3Sanitizer.