Package 

Class TagsHelper


  • 
    public final class TagsHelper
    
                        

    Helper class for handling tags

    • Method Summary

      Modifier and Type Method Description
      static String sanitize(String tag) Taken from:https://github.com/DataDog/logs-backend/blob/d0b3289ce2c63c1e8f961f03fc4e03318fb36b0f/processing/src/main/java/com/dd/logs/processing/common/Tags.
      static String concatTags(Array<String> tags)
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • sanitize

         static String sanitize(String tag)

        Taken from:https://github.com/DataDog/logs-backend/blob/d0b3289ce2c63c1e8f961f03fc4e03318fb36b0f/processing/src/main/java/com/dd/logs/processing/common/Tags.java#L44

        Sanitizes a tag, more or less following (but not exactly) as per recommended DataDogguidelines.

        See the exact guidelines:https://docs.datadoghq.com/getting_started/tagging/#tags-best-practices

        1. Tags must start with a letter, and after that may contain: - Alphanumerics - Underscores- Minuses - Colons - Periods - Slashes Other special characters get converted to underscores.Note: A tag cannot end with a colon (e.g., tag:)

        2. Tags can be up to 200 characters long and support unicode.

        3. Tags are converted to lowercase.

        4. A tag can have a value or a key:value syntax: For optimal functionality, we recommendconstructing tags that use the key:value syntax. The key is always what precedes the firstcolon of the global tag definition, e.g.: - role:database:mysql is parsed as key:role ,value:database:mysql - role_database:mysql is parsed as key:role_database , value:mysqlExamples of commonly used metric tag keys are env, instance, name, and role.

        5. device, host, and source are reserved tag keys and cannot be specified in the standardway.

        6. Tags shouldn't originate from unbounded sources, such as EPOCH timestamps or user IDs.These tags may impact platform performance and billing.

        Changes: we trim leading and trailing spaces.

        Parameters:
        tag - The tag to sanitize.