Package org.springframework.scheduling.support

# Class ScheduledTaskObservationContext

java.lang.Object
io.micrometer.observation.Observation.Context
org.springframework.scheduling.support.ScheduledTaskObservationContext

All Implemented Interfaces:
  `io.micrometer.observation.Observation.ContextView`

public class ScheduledTaskObservationContext extends io.micrometer.observation.Observation.Context
Context that holds information for observation metadata collection during the `execution of scheduled tasks`.

Since:
  6.1
Author:
  Brian Clozel

## Constructor Summary

Constructors
Constructor
Description
`ScheduledTaskObservationContext(Object target, Method method)`
Create a new observation context for a task, given the target object and the method to be called.

## Method Summary

Modifier and Type
Method
Description
`Method`
`getMethod()`
Return the method that is called for task execution.
`Class<?>`
`getTargetClass()`
Return the type of the target object.
`boolean`
`isComplete()`
Return whether the task execution is complete.
`void`
`setComplete(boolean complete)`
Set whether the task execution has completed.

### Methods inherited from class io.micrometer.observation.Observation.Context

`addHighCardinalityKeyValue, addHighCardinalityKeyValues, addLowCardinalityKeyValue, addLowCardinalityKeyValues, clear, computeIfAbsent, containsKey, get, getAllKeyValues, getContextualName, getError, getHighCardinalityKeyValue, getHighCardinalityKeyValues, getLowCardinalityKeyValue, getLowCardinalityKeyValues, getName, getOrDefault, getParentObservation, getRequired, put, remove, removeHighCardinalityKeyValue, removeHighCardinalityKeyValues, removeLowCardinalityKeyValue, removeLowCardinalityKeyValues, setContextualName, setError, setName, setParentObservation, toString`

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

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

### Methods inherited from interface io.micrometer.observation.Observation.ContextView

`getOrDefault`

## Constructor Details

### ScheduledTaskObservationContext

public ScheduledTaskObservationContext(Object target, Method method)
Create a new observation context for a task, given the target object and the method to be called.

Parameters:
  `target` - the target object that is called for task execution
  `method` - the method that is called for task execution

## Method Details

### getTargetClass

public Class<?> getTargetClass()
Return the type of the target object.

### getMethod

public Method getMethod()
Return the method that is called for task execution.

### isComplete

public boolean isComplete()
Return whether the task execution is complete.

If an observation has ended and the task is not complete, this means that an `error` was raised or that the task execution got cancelled during its execution.

### setComplete

public void setComplete(boolean complete)
Set whether the task execution has completed.