Skip to content
This repository was archived by the owner on May 14, 2025. It is now read-only.

Commit ef4fe8e

Browse files
authored
Align with 2.7.x WF tile activation metrics (#4133)
* Align with 2.7.x WF tile activation metrics - Back port Server dashboard configurations. - change the wavefront activation metrics to the spring.clodu.dataflow.server.* - add SCDF application metrics tag to be the name of the jar. - enable SCDF HTTP metrics percentiles. - Upgrade to latest Prometheus Rsocket RPoxy 1.2.1 - Fix broken configurations in prometheus and influx dockcker-compose files. - Update prometheus and Grafana container image versions. - retrofit the scdf-servers.json dashboard for Grafana. * Exclude the Task metrcis tags from the SCDF metrics * Bump micrometer version to 1.5.3 to unify the LongTaskTimer metrics naming
1 parent 02d3b09 commit ef4fe8e

File tree

16 files changed

+5757
-75
lines changed

16 files changed

+5757
-75
lines changed

pom.xml

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,8 @@
9494
<findbugs.version>3.0.2</findbugs.version>
9595
<aws-java-sdk-ecr.version>1.11.731</aws-java-sdk-ecr.version>
9696
<commons-text.version>1.8</commons-text.version>
97-
<prometheus-rsocket-spring.version>0.11.0</prometheus-rsocket-spring.version>
97+
<prometheus-rsocket-spring.version>1.2.1</prometheus-rsocket-spring.version>
98+
<micrometer.version>1.5.3</micrometer.version>
9899
</properties>
99100
<modules>
100101
<module>spring-cloud-dataflow-configuration-metadata</module>
@@ -270,6 +271,26 @@
270271
<artifactId>prometheus-rsocket-spring</artifactId>
271272
<version>${prometheus-rsocket-spring.version}</version>
272273
</dependency>
274+
<dependency>
275+
<groupId>io.micrometer</groupId>
276+
<artifactId>micrometer-core</artifactId>
277+
<version>${micrometer.version}</version>
278+
</dependency>
279+
<dependency>
280+
<groupId>io.micrometer</groupId>
281+
<artifactId>micrometer-registry-wavefront</artifactId>
282+
<version>${micrometer.version}</version>
283+
</dependency>
284+
<dependency>
285+
<groupId>io.micrometer</groupId>
286+
<artifactId>micrometer-registry-influx</artifactId>
287+
<version>${micrometer.version}</version>
288+
</dependency>
289+
<dependency>
290+
<groupId>io.micrometer</groupId>
291+
<artifactId>micrometer-registry-prometheus</artifactId>
292+
<version>${micrometer.version}</version>
293+
</dependency>
273294

274295
</dependencies>
275296
</dependencyManagement>

spring-cloud-dataflow-composed-task-runner/src/test/java/org/springframework/cloud/dataflow/composedtaskrunner/configuration/DataFlowTestConfiguration.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
package org.springframework.cloud.dataflow.composedtaskrunner.configuration;
1818

19-
import io.micrometer.prometheus.rsocket.autoconfigure.PrometheusRSocketAutoConfiguration;
19+
import io.micrometer.prometheus.rsocket.autoconfigure.PrometheusRSocketClientAutoConfiguration;
2020

2121
import org.springframework.boot.actuate.autoconfigure.metrics.export.influx.InfluxMetricsExportAutoConfiguration;
2222
import org.springframework.boot.actuate.autoconfigure.metrics.export.prometheus.PrometheusMetricsExportAutoConfiguration;
@@ -35,7 +35,7 @@
3535
@Configuration
3636
@EnableAutoConfiguration(exclude = { DataFlowClientAutoConfiguration.class,
3737
WavefrontMetricsExportAutoConfiguration.class, PrometheusMetricsExportAutoConfiguration.class,
38-
PrometheusRSocketAutoConfiguration.class, InfluxMetricsExportAutoConfiguration.class })
38+
PrometheusRSocketClientAutoConfiguration.class, InfluxMetricsExportAutoConfiguration.class })
3939
public class DataFlowTestConfiguration {
4040

4141
@Bean

spring-cloud-dataflow-server-core/pom.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@
99
<artifactId>spring-cloud-dataflow-server-core</artifactId>
1010
<packaging>jar</packaging>
1111
<dependencies>
12+
<dependency>
13+
<groupId>io.micrometer</groupId>
14+
<artifactId>micrometer-core</artifactId>
15+
</dependency>
1216
<dependency>
1317
<groupId>io.micrometer</groupId>
1418
<artifactId>micrometer-registry-wavefront</artifactId>

spring-cloud-dataflow-server-core/src/main/java/org/springframework/cloud/dataflow/server/config/MetricsReplicationEnvironmentPostProcessor.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
import java.util.Properties;
2222
import java.util.function.Consumer;
2323

24-
import io.micrometer.prometheus.rsocket.autoconfigure.PrometheusRSocketProperties;
24+
import io.micrometer.prometheus.rsocket.autoconfigure.PrometheusRSocketClientProperties;
2525
import org.slf4j.Logger;
2626
import org.slf4j.LoggerFactory;
2727

@@ -96,7 +96,7 @@ public void postProcessEnvironment(ConfigurableEnvironment environment, SpringAp
9696
this.replicateServerMetricsPropertiesToStreamAndTask(environment, WavefrontProperties.class, propertyReplicator);
9797
this.replicateServerMetricsPropertiesToStreamAndTask(environment, InfluxProperties.class, propertyReplicator);
9898
this.replicateServerMetricsPropertiesToStreamAndTask(environment, PrometheusProperties.class, propertyReplicator);
99-
this.replicateServerMetricsPropertiesToStreamAndTask(environment, PrometheusRSocketProperties.class, propertyReplicator);
99+
this.replicateServerMetricsPropertiesToStreamAndTask(environment, PrometheusRSocketClientProperties.class, propertyReplicator);
100100
}
101101

102102
// This post-processor is called multiple times but sets the properties only once.

spring-cloud-dataflow-server-core/src/main/java/org/springframework/cloud/dataflow/server/config/web/WebConfiguration.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@
2525
import com.fasterxml.jackson.databind.ObjectMapper;
2626
import com.fasterxml.jackson.datatype.jdk8.Jdk8Module;
2727
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
28+
import io.micrometer.core.instrument.LongTaskTimer;
29+
import io.micrometer.core.instrument.Metrics;
30+
import io.micrometer.core.instrument.Tags;
2831
import org.h2.tools.Server;
2932
import org.slf4j.LoggerFactory;
3033

@@ -76,6 +79,8 @@ public class WebConfiguration implements ServletContextInitializer, ApplicationL
7679

7780
private Server server = null;
7881

82+
private LongTaskTimer.Sample longTaskSample;
83+
7984
public Server initH2TCPServer() {
8085
logger.info("Starting H2 Server with URL: " + dataSourceUrl);
8186
try {
@@ -97,6 +102,11 @@ private String getH2Port(String url) {
97102

98103
@Override
99104
public void onStartup(ServletContext servletContext) {
105+
LongTaskTimer longTaskTimer = LongTaskTimer
106+
.builder("spring.cloud.dataflow.server").description("Spring Cloud Data Flow duration timer")
107+
.tags(Tags.empty()).register(Metrics.globalRegistry);
108+
this.longTaskSample = longTaskTimer.start();
109+
100110
if (StringUtils.hasText(dataSourceUrl) && dataSourceUrl.startsWith("jdbc:h2:tcp://localhost:")) {
101111
logger.info("Start Embedded H2");
102112
initH2TCPServer();
@@ -161,6 +171,11 @@ public Object postProcessAfterInitialization(Object bean, String s) throws Beans
161171

162172
@Override
163173
public void onApplicationEvent(ContextClosedEvent event) {
174+
if (this.longTaskSample != null) {
175+
this.longTaskSample.stop();
176+
this.longTaskSample = null;
177+
}
178+
164179
if (this.server != null) {
165180
this.server.stop();
166181
logger.info("Embedded H2 server stopped!");

spring-cloud-dataflow-server-core/src/main/resources/META-INF/dataflow-server-defaults.yml

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
management:
22
metrics:
3+
tags:
4+
application: ${info.app.name}
5+
application.version: ${info.app.version}
36
web:
47
server:
58
request:
69
autotime:
710
enabled: true
8-
metric-name: 'spring.cloud.dataflow.http.server.requests'
11+
percentiles-histogram: true
912
export:
1013
influx:
1114
enabled: false
@@ -41,11 +44,14 @@ spring:
4144
initialize-schema: never
4245
jpa:
4346
properties:
44-
hibernate.id.new_generator_mappings: true
47+
hibernate:
48+
id.new_generator_mappings: true
49+
# Statistics generation is required for publishing JPA micrometer metrics.
50+
# generate_statistics: true
4551
hibernate:
46-
naming:
47-
physical-strategy: org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy
48-
implicit-strategy: org.springframework.boot.orm.jpa.hibernate.SpringImplicitNamingStrategy
52+
naming:
53+
physical-strategy: org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy
54+
implicit-strategy: org.springframework.boot.orm.jpa.hibernate.SpringImplicitNamingStrategy
4955
flyway:
5056
enabled: true
5157
baselineVersion: 1

spring-cloud-dataflow-server/docker-compose-influxdb.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ services:
2222
},
2323
"spring.cloud.dataflow.metrics.dashboard": {
2424
"url":"http://localhost:3000",
25-
"type=GRAFANA"
25+
"type":"GRAFANA"
2626
}
2727
}
2828

spring-cloud-dataflow-server/docker-compose-prometheus.yml

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -9,39 +9,42 @@ services:
99
- |
1010
SPRING_APPLICATION_JSON=
1111
{
12-
"spring.cloud.dataflow.applicationProperties":{
13-
"task.management.metrics.export.prometheus":{
14-
"enabled":true,
15-
"rsocket.enabled":true,
16-
"rsocket.host":"prometheus-rsocket-proxy",
17-
"rsocket.port":7001
18-
},
19-
"stream.management.metrics.export.prometheus":{
20-
"enabled":true,
21-
"rsocket.enabled":true,
22-
"rsocket.host":"prometheus-rsocket-proxy",
23-
"rsocket.port":7001
24-
}
12+
"management.metrics.export.prometheus":{
13+
"enabled":true,
14+
"rsocket.enabled":true,
15+
"rsocket.host":"prometheus-rsocket-proxy",
16+
"rsocket.port":7001
2517
},
2618
"spring.cloud.dataflow.metrics.dashboard": {
2719
"url":"http://localhost:3000",
28-
"type=GRAFANA"
29-
}
20+
"type": "GRAFANA"
21+
},
22+
"spring.jpa.properties.hibernate.generate_statistics":true
3023
}
3124
25+
skipper-server:
26+
environment:
27+
- management.metrics.export.prometheus.enabled=true
28+
- management.metrics.export.prometheus.rsocket.enabled=true
29+
- management.metrics.export.prometheus.rsocket.host=prometheus-rsocket-proxy
30+
- management.metrics.export.prometheus.rsocket.port=7001
31+
- spring.jpa.properties.hibernate.generate_statistics=true
32+
3233
prometheus-rsocket-proxy:
33-
image: micrometermetrics/prometheus-rsocket-proxy:0.11.0
34+
image: micrometermetrics/prometheus-rsocket-proxy:1.2.1
3435
container_name: prometheus-rsocket-proxy
3536
expose:
3637
- '9096'
3738
- '7001'
38-
- '8081'
39+
- '8086'
3940
ports:
4041
- '9096:9096'
4142
- '7001:7001'
42-
- '8081:8081'
43+
- '8086:8086'
4344
environment:
4445
- server.port=9096
46+
- micrometer.prometheus-proxy.tcp-port=7001
47+
- micrometer.prometheus-proxy.websocket-port=8086
4548

4649
grafana:
4750
image: springcloud/spring-cloud-dataflow-grafana-prometheus:${DATAFLOW_VERSION:?DATAFLOW_VERSION is not set! Use 'export DATAFLOW_VERSION=local-server-image-tag'}

spring-cloud-dataflow-server/docker-compose-wavefront.yml

Lines changed: 8 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -10,49 +10,16 @@ version: '3'
1010
services:
1111
dataflow-server:
1212
environment:
13-
# - |
14-
# SPRING_APPLICATION_JSON=
15-
# {
16-
# "management.metrics.export.wavefront":{
17-
# "enabled":true,
18-
# "api-token":"${WAVEFRONT_KEY:?WAVEFRONT_KEY is not set!}",
19-
# "uri":"${WAVEFRONT_URI:-https://vmware.wavefront.com}",
20-
# "source":"${WAVEFRONT_SOURCE:-scdf-docker-compose}"
21-
# },
22-
# "management.metrics.export.prometheus":{
23-
# "enabled":true,
24-
# "rsocket.enabled":true,
25-
# "rsocket.host":"prometheus-rsocket-proxy",
26-
# "rsocket.port":7001
27-
# },
28-
# "management.metrics.export.influx":{
29-
# "enabled":true,
30-
# "db":"myinfluxdb",
31-
# "uri":"http://influxdb:8086"
32-
# }
33-
# }
34-
35-
# - MANAGEMENT_METRICS_EXPORT_WAVEFRONT_ENABLED=true
36-
# - MANAGEMENT_METRICS_EXPORT_WAVEFRONT_API-TOKEN=${WAVEFRONT_KEY:?WAVEFRONT_KEY is not set!}
37-
# - MANAGEMENT_METRICS_EXPORT_WAVEFRONT_URI=${WAVEFRONT_URI:-https://vmware.wavefront.com}
38-
# - MANAGEMENT_METRICS_EXPORT_WAVEFRONT_SOURCE=${WAVEFRONT_SOURCE:-scdf-docker-compose}
39-
4013
- management.metrics.export.wavefront.enabled=true
4114
- management.metrics.export.wavefront.api-token=${WAVEFRONT_KEY:?WAVEFRONT_KEY is not set!}
4215
- management.metrics.export.wavefront.uri=${WAVEFRONT_URI:-https://vmware.wavefront.com}
4316
- management.metrics.export.wavefront.source=${WAVEFRONT_SOURCE:-scdf-docker-compose}
17+
- spring.jpa.properties.hibernate.generate_statistics=true
4418

45-
46-
# - spring.cloud.dataflow.applicationProperties.stream.management.metrics.export.wavefront.enabled=true
47-
# - spring.cloud.dataflow.applicationProperties.stream.management.metrics.export.wavefront.api-token=${WAVEFRONT_KEY:?WAVEFRONT_KEY is not set!}
48-
# - spring.cloud.dataflow.applicationProperties.stream.management.metrics.export.wavefront.uri=${WAVEFRONT_URI:-https://vmware.wavefront.com}
49-
# - spring.cloud.dataflow.applicationProperties.stream.management.metrics.export.wavefront.source=${WAVEFRONT_SOURCE:-scdf-docker-compose}
50-
51-
# - spring.cloud.dataflow.applicationProperties.task.management.metrics.export.wavefront.enabled=true
52-
# - spring.cloud.dataflow.applicationProperties.task.management.metrics.export.wavefront.api-token=${WAVEFRONT_KEY:?WAVEFRONT_KEY is not set!}
53-
# - spring.cloud.dataflow.applicationProperties.task.management.metrics.export.wavefront.uri=${WAVEFRONT_URI:-https://vmware.wavefront.com}
54-
# - spring.cloud.dataflow.applicationProperties.task.management.metrics.export.wavefront.source=${WAVEFRONT_SOURCE:-scdf-docker-compose}
55-
56-
# - spring.cloud.dataflow.metrics.dashboard.url=http://vmware.wavefront.com
57-
# - spring.cloud.dataflow.metrics.dashboard.type=WAVEFRONT
58-
# - spring.cloud.dataflow.metrics.dashboard.wavefront.source=${WAVEFRONT_SOURCE:-scdf-docker-compose}
19+
skipper-server:
20+
environment:
21+
- management.metrics.export.wavefront.enabled=true
22+
- management.metrics.export.wavefront.api-token=${WAVEFRONT_KEY:?WAVEFRONT_KEY is not set!}
23+
- management.metrics.export.wavefront.uri=${WAVEFRONT_URI:-https://vmware.wavefront.com}
24+
- management.metrics.export.wavefront.source=${WAVEFRONT_SOURCE:-scdf-docker-compose}
25+
- spring.jpa.properties.hibernate.generate_statistics=true

spring-cloud-dataflow-server/src/main/java/org/springframework/cloud/dataflow/server/single/DataFlowServerApplication.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import org.springframework.cloud.deployer.spi.cloudfoundry.CloudFoundryDeployerAutoConfiguration;
2727
import org.springframework.cloud.deployer.spi.kubernetes.KubernetesAutoConfiguration;
2828
import org.springframework.cloud.deployer.spi.local.LocalDeployerAutoConfiguration;
29+
import org.springframework.cloud.task.configuration.MetricsAutoConfiguration;
2930

3031
/**
3132
* Bootstrap class for the Spring Cloud Data Flow Server.
@@ -35,6 +36,7 @@
3536
* @author Janne Valkealahti
3637
*/
3738
@SpringBootApplication(exclude = {
39+
MetricsAutoConfiguration.class,
3840
SessionAutoConfiguration.class,
3941
ManagementWebSecurityAutoConfiguration.class,
4042
SecurityAutoConfiguration.class,

0 commit comments

Comments
 (0)