Browse Source

Add a demo docker-compose for testing the meter module (#6938)

3.0.0/version-upgrade
kezhenxu94 3 years ago committed by GitHub
parent
commit
2de4a3cbb5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      dolphinscheduler-alert/dolphinscheduler-alert-server/pom.xml
  2. 12
      dolphinscheduler-alert/dolphinscheduler-alert-server/src/main/resources/application-alert.yaml
  3. 4
      dolphinscheduler-api/pom.xml
  4. 9
      dolphinscheduler-api/src/main/resources/application-api.yaml
  5. 9
      dolphinscheduler-meter/pom.xml
  6. 1
      dolphinscheduler-meter/src/main/java/org/apache/dolphinscheduler/meter/MeterConfiguration.java
  7. 16
      dolphinscheduler-meter/src/main/resources/grafana-demo/dashboards/provisioning.yaml
  8. 22
      dolphinscheduler-meter/src/main/resources/grafana-demo/datasources/prom.yaml
  9. 44
      dolphinscheduler-meter/src/main/resources/grafana-demo/docker-compose.yaml
  10. 31
      dolphinscheduler-meter/src/main/resources/grafana-demo/prometheus.yml
  11. 4
      dolphinscheduler-server/pom.xml
  12. 6
      dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/MasterServer.java
  13. 2
      dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/WorkerServer.java
  14. 12
      dolphinscheduler-server/src/main/resources/application-master.yaml
  15. 12
      dolphinscheduler-server/src/main/resources/application-worker.yaml
  16. 14
      dolphinscheduler-standalone-server/src/main/resources/application-standalone.yaml
  17. 3
      script/dolphinscheduler-daemon.sh

4
dolphinscheduler-alert/dolphinscheduler-alert-server/pom.xml

@ -34,6 +34,10 @@
<groupId>org.apache.dolphinscheduler</groupId> <groupId>org.apache.dolphinscheduler</groupId>
<artifactId>dolphinscheduler-remote</artifactId> <artifactId>dolphinscheduler-remote</artifactId>
</dependency> </dependency>
<dependency>
<groupId>org.apache.dolphinscheduler</groupId>
<artifactId>dolphinscheduler-meter</artifactId>
</dependency>
<dependency> <dependency>
<groupId>org.apache.dolphinscheduler</groupId> <groupId>org.apache.dolphinscheduler</groupId>
<artifactId>dolphinscheduler-alert-dingtalk</artifactId> <artifactId>dolphinscheduler-alert-dingtalk</artifactId>

12
dolphinscheduler-alert/dolphinscheduler-alert-server/src/main/resources/application-alert.yaml

@ -18,3 +18,15 @@
spring: spring:
application: application:
name: alert-server name: alert-server
server:
port: 50053
management:
endpoints:
web:
exposure:
include: '*'
metrics:
tags:
application: ${spring.application.name}

4
dolphinscheduler-api/pom.xml

@ -34,6 +34,10 @@
<groupId>org.apache.dolphinscheduler</groupId> <groupId>org.apache.dolphinscheduler</groupId>
<artifactId>dolphinscheduler-service</artifactId> <artifactId>dolphinscheduler-service</artifactId>
</dependency> </dependency>
<dependency>
<groupId>org.apache.dolphinscheduler</groupId>
<artifactId>dolphinscheduler-meter</artifactId>
</dependency>
<dependency> <dependency>
<groupId>org.apache.dolphinscheduler</groupId> <groupId>org.apache.dolphinscheduler</groupId>

9
dolphinscheduler-api/src/main/resources/application-api.yaml

@ -38,3 +38,12 @@ spring:
max-request-size: 1024MB max-request-size: 1024MB
messages: messages:
basename: i18n/messages basename: i18n/messages
management:
endpoints:
web:
exposure:
include: '*'
metrics:
tags:
application: ${spring.application.name}

9
dolphinscheduler-meter/pom.xml

@ -35,10 +35,18 @@
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId> <artifactId>spring-boot-starter-actuator</artifactId>
</dependency> </dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-actuator</artifactId> <artifactId>spring-boot-actuator</artifactId>
</dependency> </dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-aop</artifactId>
</dependency>
<dependency> <dependency>
<groupId>io.micrometer</groupId> <groupId>io.micrometer</groupId>
<artifactId>micrometer-registry-prometheus</artifactId> <artifactId>micrometer-registry-prometheus</artifactId>
@ -53,6 +61,7 @@
<configuration> <configuration>
<excludes> <excludes>
<exclude>grafana/</exclude> <exclude>grafana/</exclude>
<exclude>grafana-demo/</exclude>
<exclude>*.yaml</exclude> <exclude>*.yaml</exclude>
</excludes> </excludes>
</configuration> </configuration>

1
dolphinscheduler-meter/src/main/java/org/apache/dolphinscheduler/meter/MeterConfiguration.java

@ -31,7 +31,6 @@ import io.micrometer.core.aop.TimedAspect;
import io.micrometer.core.instrument.MeterRegistry; import io.micrometer.core.instrument.MeterRegistry;
@Configuration @Configuration
@Profile("meter")
@EnableAspectJAutoProxy @EnableAspectJAutoProxy
@EnableAutoConfiguration @EnableAutoConfiguration
public class MeterConfiguration { public class MeterConfiguration {

16
dolphinscheduler-meter/src/main/resources/application-meter.yaml → dolphinscheduler-meter/src/main/resources/grafana-demo/dashboards/provisioning.yaml

@ -15,13 +15,9 @@
# limitations under the License. # limitations under the License.
# #
management: apiVersion: 1
endpoints: providers:
web: - name: general
exposure: folder: 'DolphinScheduler'
include: '*' options:
server: path: /dashboards
port: 5679
metrics:
tags:
application: ${spring.application.name}

22
dolphinscheduler-meter/src/main/resources/grafana-demo/datasources/prom.yaml

@ -0,0 +1,22 @@
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
apiVersion: 1
datasources:
- name: Prometheus
type: prometheus
url: http://prom:9090

44
dolphinscheduler-meter/src/main/resources/grafana-demo/docker-compose.yaml

@ -0,0 +1,44 @@
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
version: '2.1'
services:
prom:
image: prom/prometheus
networks: [ test ]
ports:
- "9090:9090"
volumes:
- ./prometheus.yml:/etc/prometheus/prometheus.yml
command:
- --config.file=/etc/prometheus/prometheus.yml
grafana:
image: grafana/grafana
networks: [ test ]
ports:
- "3000:3000"
environment:
GF_AUTH_ANONYMOUS_ENABLED: true
volumes:
- ../grafana:/dashboards:ro
- ./datasources:/etc/grafana/provisioning/datasources:ro
- ./dashboards/provisioning.yaml:/etc/grafana/provisioning/dashboards/provisioning.yaml:ro
networks:
test:

31
dolphinscheduler-meter/src/main/resources/grafana-demo/prometheus.yml

@ -0,0 +1,31 @@
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
global:
scrape_interval: 15s
evaluation_interval: 15s
rule_files:
scrape_configs:
- job_name: 'DolphinScheduler'
metrics_path: '/actuator/prometheus'
scrape_interval: 5s
static_configs:
- targets:
- 'host.docker.internal:5679' # Change the address to the address of DolphinScheduler master server
- 'host.docker.internal:1235' # Change the address to the address of DolphinScheduler worker server
- 'host.docker.internal:50053' # Change the address to the address of DolphinScheduler alert server
- 'host.docker.internal:8080' # Change the address to the DolphinScheduler standalone server

4
dolphinscheduler-server/pom.xml

@ -34,6 +34,10 @@
<groupId>org.apache.dolphinscheduler</groupId> <groupId>org.apache.dolphinscheduler</groupId>
<artifactId>dolphinscheduler-service</artifactId> <artifactId>dolphinscheduler-service</artifactId>
</dependency> </dependency>
<dependency>
<groupId>org.apache.dolphinscheduler</groupId>
<artifactId>dolphinscheduler-meter</artifactId>
</dependency>
<dependency> <dependency>
<groupId>org.apache.dolphinscheduler</groupId> <groupId>org.apache.dolphinscheduler</groupId>
<artifactId>dolphinscheduler-spi</artifactId> <artifactId>dolphinscheduler-spi</artifactId>

6
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/MasterServer.java

@ -38,15 +38,11 @@ import javax.annotation.PostConstruct;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.WebApplicationType;
import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.FilterType; import org.springframework.context.annotation.FilterType;
import org.springframework.transaction.annotation.EnableTransactionManagement; import org.springframework.transaction.annotation.EnableTransactionManagement;
/**
* master server
*/
@ComponentScan(value = "org.apache.dolphinscheduler", excludeFilters = { @ComponentScan(value = "org.apache.dolphinscheduler", excludeFilters = {
@ComponentScan.Filter(type = FilterType.REGEX, pattern = { @ComponentScan.Filter(type = FilterType.REGEX, pattern = {
"org.apache.dolphinscheduler.server.worker.*", "org.apache.dolphinscheduler.server.worker.*",
@ -80,7 +76,7 @@ public class MasterServer implements IStoppable {
Thread.currentThread().setName(Constants.THREAD_NAME_MASTER_SERVER); Thread.currentThread().setName(Constants.THREAD_NAME_MASTER_SERVER);
new SpringApplicationBuilder(MasterServer.class) new SpringApplicationBuilder(MasterServer.class)
.profiles("master") .profiles("master")
.web(WebApplicationType.NONE).run(args); .run(args);
} }
/** /**

2
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/WorkerServer.java

@ -44,7 +44,6 @@ import javax.annotation.PostConstruct;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.WebApplicationType;
import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.FilterType; import org.springframework.context.annotation.FilterType;
@ -115,7 +114,6 @@ public class WorkerServer implements IStoppable {
public static void main(String[] args) { public static void main(String[] args) {
Thread.currentThread().setName(Constants.THREAD_NAME_WORKER_SERVER); Thread.currentThread().setName(Constants.THREAD_NAME_WORKER_SERVER);
new SpringApplicationBuilder(WorkerServer.class) new SpringApplicationBuilder(WorkerServer.class)
.web(WebApplicationType.NONE)
.profiles("worker") .profiles("worker")
.run(args); .run(args);
} }

12
dolphinscheduler-server/src/main/resources/application-master.yaml

@ -45,3 +45,15 @@ master:
reserved-memory: 0.3 reserved-memory: 0.3
# master cache process definition, default: true # master cache process definition, default: true
cache-process-definition: true cache-process-definition: true
server:
port: 5679
management:
endpoints:
web:
exposure:
include: '*'
metrics:
tags:
application: ${spring.application.name}

12
dolphinscheduler-server/src/main/resources/application-worker.yaml

@ -38,3 +38,15 @@ worker:
- default - default
# alert server listen host # alert server listen host
alert-listen-host: localhost alert-listen-host: localhost
server:
port: 1235
management:
endpoints:
web:
exposure:
include: '*'
metrics:
tags:
application: ${spring.application.name}

14
dolphinscheduler-standalone-server/src/main/resources/application-standalone.yaml

@ -18,3 +18,17 @@
spring: spring:
application: application:
name: standalone-server name: standalone-server
server:
port: 12345
management:
endpoints:
web:
exposure:
include: '*'
server:
port: 8080
metrics:
tags:
application: ${spring.application.name}

3
script/dolphinscheduler-daemon.sh

@ -61,9 +61,6 @@ export DOLPHINSCHEDULER_OPTS="-server -XX:MetaspaceSize=128m -XX:MaxMetaspaceSiz
export dbtype=${dbtype:-"h2"} export dbtype=${dbtype:-"h2"}
export SPRING_PROFILES_ACTIVE=${SPRING_PROFILES_ACTIVE:-"default"} export SPRING_PROFILES_ACTIVE=${SPRING_PROFILES_ACTIVE:-"default"}
if [ "$METER_ENABLED" = "true" ]; then
export SPRING_PROFILES_ACTIVE="${SPRING_PROFILES_ACTIVE},meter"
fi
if [ "$command" = "api-server" ]; then if [ "$command" = "api-server" ]; then
LOG_FILE="-Dlogging.config=classpath:logback-api.xml" LOG_FILE="-Dlogging.config=classpath:logback-api.xml"

Loading…
Cancel
Save