Package org.springframework.core.metrics

# Interface StartupStep

public interface StartupStep
Step recording metrics about a particular phase or action happening during the `ApplicationStartup`.

The lifecycle of a `StartupStep` goes as follows:

1. the step is created and starts by calling `the application startup` and is assigned a unique `id`.
2. we can then attach information with `StartupStep.Tags` during processing
3. we then need to mark the `end()` of the step

Implementations can track the "execution time" or other metrics for steps.

Since:
  5.3
Author:
  Brian Clozel

## Nested Class Summary

Nested Classes
Modifier and Type
Interface
Description
`static interface`
`StartupStep.Tag`
Simple key/value association for storing step metadata.
`static interface`
`StartupStep.Tags`
Immutable collection of `StartupStep.Tag`.

## Method Summary

Modifier and Type
Method
Description
`void`
`end()`
Record the state of the step and possibly other metrics like execution time.
`long`
`getId()`
Return the unique id for this step within the application startup.
`String`
`getName()`
Return the name of the startup step.
`Long`
`getParentId()`
Return, if available, the id of the parent step.
`StartupStep.Tags`
`getTags()`
Return the `StartupStep.Tag` collection for this step.
`StartupStep`
`tag(String key, String value)`
Add a `StartupStep.Tag` to the step.
`StartupStep`
`tag(String key, Supplier<String> value)`
Add a `StartupStep.Tag` to the step.

## Method Details

### getName

String getName()
Return the name of the startup step.

A step name describes the current action or phase. This technical name should be "." namespaced and can be reused to describe other instances of similar steps during application startup.

### getId

long getId()
Return the unique id for this step within the application startup.

### getParentId

@Nullable Long getParentId()
Return, if available, the id of the parent step.

The parent step is the step that was started the most recently when the current step was created.

### tag

StartupStep tag(String key, String value)
Add a `StartupStep.Tag` to the step.

Parameters:
  `key` - tag key
  `value` - tag value

### tag

StartupStep tag(String key, Supplier<String> value)
Add a `StartupStep.Tag` to the step.

Parameters:
  `key` - tag key
  `value` - `Supplier` for the tag value

### getTags

StartupStep.Tags getTags()
Return the `StartupStep.Tag` collection for this step.

### end

void end()
Record the state of the step and possibly other metrics like execution time.

Once ended, changes on the step state are not allowed.