This commit is contained in:
Marcin Grzejszczak
2023-09-08 16:35:57 +02:00
parent 4595ffc819
commit 3224bf8d4c
17 changed files with 225 additions and 46 deletions

View File

@@ -10,7 +10,3 @@
* xref:appendix.adoc[]
* xref:appendix-task-repository-schema.adoc[]
* xref:appendix-building-the-documentation.adoc[]
* xref:_observability.adoc[]
* xref:README.adoc[]
* xref:_configprops.adoc[]
* xref:sagan-index.adoc[]

View File

@@ -1,58 +0,0 @@
[[spring-cloud-task]]
= Spring Cloud Task
Is a project centered around the idea of processing on demand. A user is able to develop
a “task” that can be deployed, executed and removed on demand, yet the result of the
process persists beyond the life of the task for future reporting.
[[requirements:]]
== Requirements:
* Java 17 or Above
[[build-main-project:]]
== Build Main Project:
[source,shell,indent=2]
----
$ ./mvnw clean install
----
[[example:]]
== Example:
[source,java,indent=2]
----
@SpringBootApplication
@EnableTask
public class MyApp {
@Bean
public MyTaskApplication myTask() {
return new MyTaskApplication();
}
public static void main(String[] args) {
SpringApplication.run(MyApp.class);
}
public static class MyTaskApplication implements ApplicationRunner {
@Override
public void run(ApplicationArguments args) throws Exception {
System.out.println("Hello World");
}
}
}
----
[[code-of-conduct]]
== Code of Conduct
This project adheres to the Contributor Covenant link:CODE_OF_CONDUCT.adoc[code of conduct]. By participating, you are expected to uphold this code. Please report unacceptable behavior to spring-code-of-conduct@pivotal.io.
[[building-the-project]]
== Building the Project
This project requires that you invoke the Javadoc engine from the Maven command line. You can do so by appending `javadoc:aggregate` to the rest of your Maven command.
For example, to build the entire project, you could use `mvn clean install -DskipTests -P docs`.

View File

@@ -1,9 +0,0 @@
:root-target: ../../../target/
[[observability]]
= Observability metadata
:page-section-summary-toc: 1
include::{root-target}_metrics.adoc[]
include::{root-target}_spans.adoc[]

View File

@@ -13,7 +13,6 @@ https://spring.io/projects/spring-batch[Spring Batch documentation].
To obtain the starter for Maven, add the following to your build:
====
[source,xml]
----
<dependency>
@@ -22,16 +21,13 @@ To obtain the starter for Maven, add the following to your build:
<version>2.3.0</version>
</dependency>
----
====
To obtain the starter for Gradle, add the following to your build:
====
[source,groovy]
----
compile "org.springframework.cloud:spring-cloud-starter-single-step-batch-job:2.3.0"
----
====
[[job-definition]]
== Defining a Job

View File

@@ -0,0 +1,6 @@
[[configuration-properties]]
= Configuration Properties
Below you can find a list of configuration properties.
include::partial$_configprops.adoc[]

View File

@@ -0,0 +1,6 @@
[[observability]]
== Observability metadata
include::partial$_metrics.adoc[]
include::partial$_spans.adoc[]

View File

@@ -1,2 +0,0 @@
Spring Cloud Task allows a user to develop and run short lived microservices using Spring Cloud and run them locally, in the cloud, even on Spring Cloud Data Flow. Just add `@EnableTask` and run your app as a Spring Boot app (single application context).
If you are new to Spring Cloud Task, take a look at our https://docs.spring.io/spring-cloud-task/docs/2.0.0.RELEASE/reference/htmlsingle/#getting-started[Getting Started] docs.

View File

@@ -41,4 +41,4 @@
|spring.cloud.task.single-instance-lock-ttl | | Declares the maximum amount of time (in millis) that a task execution can hold a lock to prevent another task from executing with a specific task name when the single-instance-enabled is set to true. Default time is: Integer.MAX_VALUE.
|spring.cloud.task.table-prefix | `+++TASK_+++` | The prefix to append to the table names created by Spring Cloud Task.
|===
|===

View File

@@ -0,0 +1,13 @@
[[observability-conventions]]
=== Observability - Conventions
Below you can find a list of all `GlobalObservationConvention` and `ObservationConvention` declared by this project.
.ObservationConvention implementations
|===
|ObservationConvention Class Name | Applicable ObservationContext Class Name
|`org.springframework.cloud.task.listener.DefaultTaskExecutionObservationConvention`|`TaskExecutionObservationContext`
|`org.springframework.cloud.task.listener.TaskExecutionObservationConvention`|`TaskExecutionObservationContext`
|`org.springframework.cloud.task.configuration.observation.DefaultTaskObservationConvention`|`TaskObservationContext`
|`org.springframework.cloud.task.configuration.observation.TaskObservationConvention`|`TaskObservationContext`
|===

View File

@@ -0,0 +1,82 @@
[[observability-metrics]]
=== Observability - Metrics
Below you can find a list of all metrics declared by this project.
[[observability-metrics-task-active]]
==== Task Active
____
Metrics created around a task execution.
____
**Metric name** `spring.cloud.task` (defined by convention class `org.springframework.cloud.task.listener.DefaultTaskExecutionObservationConvention`). **Type** `timer`.
**Metric name** `spring.cloud.task.active` (defined by convention class `org.springframework.cloud.task.listener.DefaultTaskExecutionObservationConvention`). **Type** `long task timer`.
IMPORTANT: KeyValues that are added after starting the Observation might be missing from the *.active metrics.
IMPORTANT: Micrometer internally uses `nanoseconds` for the baseunit. However, each backend determines the actual baseunit. (i.e. Prometheus uses seconds)
Fully qualified name of the enclosing class `org.springframework.cloud.task.listener.TaskExecutionObservation`.
IMPORTANT: All tags must be prefixed with `spring.cloud.task` prefix!
.Low cardinality Keys
[cols="a,a"]
|===
|Name | Description
|`spring.cloud.task.cf.app.id` _(required)_|App id for CF cloud.
|`spring.cloud.task.cf.app.name` _(required)_|App name for CF cloud.
|`spring.cloud.task.cf.app.version` _(required)_|App version for CF cloud.
|`spring.cloud.task.cf.instance.index` _(required)_|Instance index for CF cloud.
|`spring.cloud.task.cf.org.name` _(required)_|Organization Name for CF cloud.
|`spring.cloud.task.cf.space.id` _(required)_|Space id for CF cloud.
|`spring.cloud.task.cf.space.name` _(required)_|Space name for CF cloud.
|`spring.cloud.task.execution.id` _(required)_|Task execution id.
|`spring.cloud.task.exit.code` _(required)_|Task exit code.
|`spring.cloud.task.external.execution.id` _(required)_|External execution id for task.
|`spring.cloud.task.name` _(required)_|Task name measurement.
|`spring.cloud.task.parent.execution.id` _(required)_|Task parent execution id.
|`spring.cloud.task.status` _(required)_|task status. Can be either success or failure.
|===
[[observability-metrics-task-runner-observation]]
==== Task Runner Observation
____
Observation created when a task runner is executed.
____
**Metric name** `spring.cloud.task.runner` (defined by convention class `org.springframework.cloud.task.configuration.observation.DefaultTaskObservationConvention`). **Type** `timer`.
**Metric name** `spring.cloud.task.runner.active` (defined by convention class `org.springframework.cloud.task.configuration.observation.DefaultTaskObservationConvention`). **Type** `long task timer`.
IMPORTANT: KeyValues that are added after starting the Observation might be missing from the *.active metrics.
IMPORTANT: Micrometer internally uses `nanoseconds` for the baseunit. However, each backend determines the actual baseunit. (i.e. Prometheus uses seconds)
Fully qualified name of the enclosing class `org.springframework.cloud.task.configuration.observation.TaskDocumentedObservation`.
IMPORTANT: All tags must be prefixed with `spring.cloud.task` prefix!
.Low cardinality Keys
[cols="a,a"]
|===
|Name | Description
|`spring.cloud.task.runner.bean-name` _(required)_|Name of the bean that was executed by Spring Cloud Task.
|===

View File

@@ -0,0 +1,56 @@
[[observability-spans]]
=== Observability - Spans
Below you can find a list of all spans declared by this project.
[[observability-spans-task-active]]
==== Task Active Span
> Metrics created around a task execution.
**Span name** `spring.cloud.task` (defined by convention class `org.springframework.cloud.task.listener.DefaultTaskExecutionObservationConvention`).
Fully qualified name of the enclosing class `org.springframework.cloud.task.listener.TaskExecutionObservation`.
IMPORTANT: All tags must be prefixed with `spring.cloud.task` prefix!
.Tag Keys
|===
|Name | Description
|`spring.cloud.task.cf.app.id` _(required)_|App id for CF cloud.
|`spring.cloud.task.cf.app.name` _(required)_|App name for CF cloud.
|`spring.cloud.task.cf.app.version` _(required)_|App version for CF cloud.
|`spring.cloud.task.cf.instance.index` _(required)_|Instance index for CF cloud.
|`spring.cloud.task.cf.org.name` _(required)_|Organization Name for CF cloud.
|`spring.cloud.task.cf.space.id` _(required)_|Space id for CF cloud.
|`spring.cloud.task.cf.space.name` _(required)_|Space name for CF cloud.
|`spring.cloud.task.execution.id` _(required)_|Task execution id.
|`spring.cloud.task.exit.code` _(required)_|Task exit code.
|`spring.cloud.task.external.execution.id` _(required)_|External execution id for task.
|`spring.cloud.task.name` _(required)_|Task name measurement.
|`spring.cloud.task.parent.execution.id` _(required)_|Task parent execution id.
|`spring.cloud.task.status` _(required)_|task status. Can be either success or failure.
|===
[[observability-spans-task-runner-observation]]
==== Task Runner Observation Span
> Observation created when a task runner is executed.
**Span name** `spring.cloud.task.runner` (defined by convention class `org.springframework.cloud.task.configuration.observation.DefaultTaskObservationConvention`).
Fully qualified name of the enclosing class `org.springframework.cloud.task.configuration.observation.TaskDocumentedObservation`.
IMPORTANT: All tags must be prefixed with `spring.cloud.task` prefix!
.Tag Keys
|===
|Name | Description
|`spring.cloud.task.runner.bean-name` _(required)_|Name of the bean that was executed by Spring Cloud Task.
|===