Improve the wavefront demo task

This commit is contained in:
Christian Tzolov
2020-07-24 14:22:58 +02:00
parent cee79f3c8d
commit 34473b025b
3 changed files with 18 additions and 3 deletions

View File

@@ -8,6 +8,7 @@
<version>2.3.1.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.example.task</groupId>
<artifactId>task-demo-metrics-wavefront</artifactId>
<version>0.0.1-SNAPSHOT</version>
@@ -69,6 +70,15 @@
<groupId>io.micrometer</groupId>
<artifactId>micrometer-registry-wavefront</artifactId>
</dependency>
<!-- Override the WF SDK dependency coming with micrometer to resolve
the https://github.com/wavefrontHQ/wavefront-sdk-java/pull/152 makes it
to Micrometer (likely 1.5.3) and Boot-->
<dependency>
<groupId>com.wavefront</groupId>
<artifactId>wavefront-sdk-java</artifactId>
<version>2.6.0</version>
</dependency>
</dependencies>
<dependencyManagement>

View File

@@ -48,7 +48,7 @@ public class TaskDemoMetricsApplication {
public Step step1() {
return this.stepBuilderFactory.get("step1")
.<Integer, Integer>chunk(10)
.reader(new ListItemReader<>(IntStream.rangeClosed(0, this.random.nextInt(10000))
.reader(new ListItemReader<>(IntStream.rangeClosed(0, this.random.nextInt(10 * 1000))
.boxed().collect(Collectors.toList())))
.writer(list -> list.forEach(e -> {
if ((e % 100) == 0) {
@@ -61,7 +61,7 @@ public class TaskDemoMetricsApplication {
public Step step2() {
return this.stepBuilderFactory.get("step2")
.tasklet((contribution, context) -> {
Thread.sleep(this.random.nextInt(10000));
Thread.sleep(3 * 60 * 1000 + this.random.nextInt(10000));
return RepeatStatus.FINISHED;
}).build();
}
@@ -71,7 +71,7 @@ public class TaskDemoMetricsApplication {
return jobBuilderFactory.get("job2")
.start(stepBuilderFactory.get("job2step1")
.tasklet((contribution, chunkContext) -> {
Thread.sleep(this.random.nextInt(10000));
Thread.sleep(2 * 60 * 1000 + this.random.nextInt(10000));
return RepeatStatus.FINISHED;
})
.build())

View File

@@ -3,3 +3,8 @@ info.app.name=@project.artifactId@
info.app.description=@project.description@
info.app.version=@project.version@
management.endpoints.web.exposure.include=health,info,bindings
#management.metrics.export.wavefront.enabled=true
#management.metrics.export.wavefront.api-token=
#management.metrics.export.wavefront.uri=
#management.metrics.export.wavefront.source=TASK-TEST