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

Feature request : utility tag sanitization method #16

Closed
mgravell opened this issue Apr 17, 2015 · 4 comments
Closed

Feature request : utility tag sanitization method #16

mgravell opened this issue Apr 17, 2015 · 4 comments

Comments

@mgravell
Copy link
Collaborator

Not all tag values are valid; the library includes features to check for invalid tags, but it would be nice if it exposed something on the public API to sanitize tag values (perhaps simply removing all illegal characters)

@bretcope
Copy link
Contributor

This would be super simple. Just need to provide a function which does a replace on the InvalidChars regex. Probably all of that Validation class could be moved and made public.

@bretcope
Copy link
Contributor

I guess I forgot that there already is a NameTransformers.Sanitize() which converts all spans of invalid chars to a single underscore (or simply removes it if it's at the beginning or end of the string).

I'll probably keep that the way it is, and also make the invalid chars regex public so that people can write their own sanitize function if they want different functionality.

@bretcope
Copy link
Contributor

I've made this change. The validation class is now named BosunValidation, and is public under the top namespace.

I also added a global tag value sanitize/normalize function option which you could use if you want the ability to apply a function to tag values across all metrics. See BosunOptions.cs.

@mgravell
Copy link
Collaborator Author

Awesome; thanks
On 21 Apr 2015 2:28 am, "Bret Copeland" notifications@github.com wrote:

I've made this change. The validation class is now named BosunValidation,
and is public under the top namespace.

I also added a global tag value sanitize/normalize function option which
you could use if you want the ability to apply a function to tag values
across all metrics. See BosunOptions.cs
https://github.com/bretcope/BosunReporter.NET/blob/master/BosunReporter/BosunOptions.cs#L58-L64
.


Reply to this email directly or view it on GitHub
#16 (comment)
.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants