Package org.springframework.cloud.task.listener

# Class TaskMetrics

java.lang.Object
org.springframework.cloud.task.listener.TaskMetrics

public class TaskMetrics extends Object
Utility class for publishing Spring Cloud Task specific metrics via Micrometer. Intended for internal use only.

Since:
  2.2
Author:
  Christian Tzolov

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final String`
  `SPRING_CLOUD_TASK_ACTIVE_METER`
  LongTask timer measurement.
  `static final String`
  `SPRING_CLOUD_TASK_METER`
  Task timer measurements.
  `static final String`
  `STATUS_FAILURE`
  Failing task execution status indicator.
  `static final String`
  `STATUS_SUCCESS`
  Successful task execution status indicator.
  `static final String`
  `TASK_EXCEPTION_TAG`
  task exception tag.
  `static final String`
  `TASK_EXECUTION_ID_TAG`
  task execution id tag.
  `static final String`
  `TASK_EXIT_CODE_TAG`
  task exit code tag.
  `static final String`
  `TASK_EXTERNAL_EXECUTION_ID_TAG`
  task external execution id tag.
  `static final String`
  `TASK_NAME_TAG`
  task name measurement tag.
  `static final String`
  `TASK_PARENT_EXECUTION_ID_TAG`
  task parent execution id tag.
  `static final String`
  `TASK_STATUS_TAG`
  task status tag.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `TaskMetrics()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `onTaskEnd(TaskExecution taskExecution)`
  `void`
  `onTaskFailed(Throwable throwable)`
  `void`
  `onTaskStartup(TaskExecution taskExecution)`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### SPRING_CLOUD_TASK_METER

    public static final String SPRING_CLOUD_TASK_METER
    Task timer measurements. Records information about task duration and status.
    See Also:
      - Constant Field Values

  - ### SPRING_CLOUD_TASK_ACTIVE_METER

    public static final String SPRING_CLOUD_TASK_ACTIVE_METER
    LongTask timer measurement. Records the run-time status of long-time lasting tasks.
    See Also:
      - Constant Field Values

  - ### STATUS_SUCCESS

    public static final String STATUS_SUCCESS
    Successful task execution status indicator.
    See Also:
      - Constant Field Values

  - ### STATUS_FAILURE

    public static final String STATUS_FAILURE
    Failing task execution status indicator.
    See Also:
      - Constant Field Values

  - ### TASK_NAME_TAG

    public static final String TASK_NAME_TAG
    task name measurement tag.
    See Also:
      - Constant Field Values

  - ### TASK_EXECUTION_ID_TAG

    public static final String TASK_EXECUTION_ID_TAG
    task execution id tag.
    See Also:
      - Constant Field Values

  - ### TASK_PARENT_EXECUTION_ID_TAG

    public static final String TASK_PARENT_EXECUTION_ID_TAG
    task parent execution id tag.
    See Also:
      - Constant Field Values

  - ### TASK_EXTERNAL_EXECUTION_ID_TAG

    public static final String TASK_EXTERNAL_EXECUTION_ID_TAG
    task external execution id tag.
    See Also:
      - Constant Field Values

  - ### TASK_EXIT_CODE_TAG

    public static final String TASK_EXIT_CODE_TAG
    task exit code tag.
    See Also:
      - Constant Field Values

  - ### TASK_STATUS_TAG

    public static final String TASK_STATUS_TAG
    task status tag. Can be either STATUS_SUCCESS or STATUS_FAILURE
    See Also:
      - Constant Field Values

  - ### TASK_EXCEPTION_TAG

    public static final String TASK_EXCEPTION_TAG
    task exception tag. Contains the name of the exception class in case of error or none otherwise.
    See Also:
      - Constant Field Values

- ## Constructor Details

  - ### TaskMetrics

    public TaskMetrics()

- ## Method Details

  - ### onTaskStartup

    public void onTaskStartup(TaskExecution taskExecution)

  - ### onTaskFailed

    public void onTaskFailed(Throwable throwable)

  - ### onTaskEnd

    public void onTaskEnd(TaskExecution taskExecution)