Hello Chris.
We already have it in documentation. http://opentsdb.net/metrics.html (Precisions on metrics and tags).
Any update on this? I have run into a similar problem with tag values. Tag names are easier to control since we don't allow just anyone to create a tag, but the values should support any unicode value.
On a related note, what would be the best practice for sending double quote in tag value? like using quotemeta before sending data to mysql? For example:
somemetric 1369783067 2320616 hostname=a1.test.com stringtag="some value contains a \" quote character"
Hello Chris. In following naive character filter we have 0.120ms vs 0.010ms(current validateString)
for 70 symbols string for validation, and it is a problem to improve performance. How much performance we ready to loose to support Unicode? /** * Ensures that a given Unicode string is a valid metric name or tag name/value. * @param what A human readable description of what's being validated. * @param s The string to validate. * @throws IllegalArgumentException if the string isn't valid. */ static void validateUnicodeString(final String what, final String s) { if (s == null) { throw new IllegalArgumentException("Invalid " + what + ": null"); } final int n = s.length(); for (int i = 0; i < n; i++) { final Character c = s.charAt(i); if (!((Character.isLetterOrDigit(c) || c.equals('-') || c.equals('_') || c.equals('.') || c.equals('/') ))) { throw new IllegalArgumentException("Invalid " + what + " (\"" + s + "\"): illegal character: " + c); } } }
Using of char instead of char wrapper gives 0.076 vs 0.010(current validateString):
Hello Folks.
As you see we use white-list filter that allow in unicode only: letters, digits, - + . / (not all unicode symbols)
So we just need to remove + – / from white-list to disallow them. As for backslash (\) we allowed it recently as it is useful for disks names.
For performance testing I use java profiler so 0.076 is good average for 70 symbols string.
--
Vasiliy Kiryanov
We could maybe turn this around and declare that there is a reserved
set of characters that we specifically do not want to allow (which
today would already need to include "{}=:-" amongst possibly other
ones) so we could exclude all the things like "!@#$%^&*()+[]:;'\"<>/?"
and such.
As you see we use white-list filter that allow in unicode only: letters, digits, - + . / (not all unicode symbols)So we just need to remove + – / from white-list to disallow them. As for backslash (\) we allowed it recently as it is useful for disks names.
Hello Friend,I facing issue while inserting the special character(#,%,°C) in OpenTSDB. I am using OpenTSDB 2.2.0 and using import command on CLI to insert data through the .gz file