Class ScopeFormat

java.lang.Object
org.apache.flink.runtime.metrics.scope.ScopeFormat
Direct Known Subclasses:
JobManagerJobScopeFormat, JobManagerOperatorScopeFormat, JobManagerScopeFormat, OperatorScopeFormat, TaskManagerJobScopeFormat, TaskManagerScopeFormat, TaskScopeFormat

public abstract class ScopeFormat extends Object
This class represents the format after which the "scope" (or namespace) of the various component metric groups is built. Component metric groups are for example "TaskManager", "Task", or "Operator".

User defined scope formats allow users to include or exclude certain identifiers from the scope. The scope for metrics belonging to the "Task" group could for example include the task attempt number (more fine grained identification), or exclude it (continuity of the namespace across failure and recovery).

  • Field Details

    • SCOPE_INHERIT_PARENT

      public static final String SCOPE_INHERIT_PARENT
      If the scope format starts with this character, then the parent components scope format will be used as a prefix.

      For example, if the TaskManager's job format is "*.<job_name>", and the TaskManager format is "<host>", then the job's metrics will have "<host>.<job_name>" as their scope.

      See Also:
    • SCOPE_SEPARATOR

      public static final String SCOPE_SEPARATOR
      See Also:
    • SCOPE_HOST

      public static final String SCOPE_HOST
    • SCOPE_TASKMANAGER_ID

      public static final String SCOPE_TASKMANAGER_ID
    • SCOPE_JOB_ID

      public static final String SCOPE_JOB_ID
    • SCOPE_JOB_NAME

      public static final String SCOPE_JOB_NAME
    • SCOPE_TASK_VERTEX_ID

      public static final String SCOPE_TASK_VERTEX_ID
    • SCOPE_TASK_NAME

      public static final String SCOPE_TASK_NAME
    • SCOPE_TASK_ATTEMPT_ID

      public static final String SCOPE_TASK_ATTEMPT_ID
    • SCOPE_TASK_ATTEMPT_NUM

      public static final String SCOPE_TASK_ATTEMPT_NUM
    • SCOPE_TASK_SUBTASK_INDEX

      public static final String SCOPE_TASK_SUBTASK_INDEX
    • SCOPE_OPERATOR_ID

      public static final String SCOPE_OPERATOR_ID
    • SCOPE_OPERATOR_NAME

      public static final String SCOPE_OPERATOR_NAME
  • Constructor Details

  • Method Details

    • format

      public String format()
    • copyTemplate

      protected final String[] copyTemplate()
    • bindVariables

      protected final String[] bindVariables(String[] template, String[] values)
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • asVariable

      public static String asVariable(String scope)
      Formats the given string to resemble a scope variable.
      Parameters:
      scope - The string to format
      Returns:
      The formatted string
    • concat

      public static String concat(org.apache.flink.metrics.CharacterFilter filter, Character delimiter, String... components)
      Concatenates the given component names separated by the delimiter character. Additionally the character filter is applied to all component names.
      Parameters:
      filter - Character filter to be applied to the component names
      delimiter - Delimiter to separate component names
      components - Array of component names
      Returns:
      The concatenated component name
    • valueOrNull

      protected static String valueOrNull(Object value)
    • arrayToMap

      protected static HashMap<String,Integer> arrayToMap(String[] array)