diff --git a/dolphinscheduler-alert/dolphinscheduler-alert-server/pom.xml b/dolphinscheduler-alert/dolphinscheduler-alert-server/pom.xml index b9375a8ad0..ac71840e93 100644 --- a/dolphinscheduler-alert/dolphinscheduler-alert-server/pom.xml +++ b/dolphinscheduler-alert/dolphinscheduler-alert-server/pom.xml @@ -34,6 +34,10 @@ org.apache.dolphinscheduler dolphinscheduler-remote + + org.apache.dolphinscheduler + dolphinscheduler-meter + org.apache.dolphinscheduler dolphinscheduler-alert-dingtalk diff --git a/dolphinscheduler-alert/dolphinscheduler-alert-server/src/main/resources/application-alert.yaml b/dolphinscheduler-alert/dolphinscheduler-alert-server/src/main/resources/application-alert.yaml index 29c16ae15e..8e5c4c5355 100644 --- a/dolphinscheduler-alert/dolphinscheduler-alert-server/src/main/resources/application-alert.yaml +++ b/dolphinscheduler-alert/dolphinscheduler-alert-server/src/main/resources/application-alert.yaml @@ -18,3 +18,15 @@ spring: application: name: alert-server + +server: + port: 50053 + +management: + endpoints: + web: + exposure: + include: '*' + metrics: + tags: + application: ${spring.application.name} diff --git a/dolphinscheduler-api/pom.xml b/dolphinscheduler-api/pom.xml index 70fd139cb9..ffb1387f06 100644 --- a/dolphinscheduler-api/pom.xml +++ b/dolphinscheduler-api/pom.xml @@ -34,6 +34,10 @@ org.apache.dolphinscheduler dolphinscheduler-service + + org.apache.dolphinscheduler + dolphinscheduler-meter + org.apache.dolphinscheduler diff --git a/dolphinscheduler-api/src/main/resources/application-api.yaml b/dolphinscheduler-api/src/main/resources/application-api.yaml index 15dcae978f..ce76b9a9de 100644 --- a/dolphinscheduler-api/src/main/resources/application-api.yaml +++ b/dolphinscheduler-api/src/main/resources/application-api.yaml @@ -38,3 +38,12 @@ spring: max-request-size: 1024MB messages: basename: i18n/messages + +management: + endpoints: + web: + exposure: + include: '*' + metrics: + tags: + application: ${spring.application.name} diff --git a/dolphinscheduler-meter/pom.xml b/dolphinscheduler-meter/pom.xml index bebe893c69..d1d62d92c1 100644 --- a/dolphinscheduler-meter/pom.xml +++ b/dolphinscheduler-meter/pom.xml @@ -35,10 +35,18 @@ org.springframework.boot spring-boot-starter-actuator + + org.springframework.boot + spring-boot-starter-web + org.springframework.boot spring-boot-actuator + + org.springframework.boot + spring-boot-starter-aop + io.micrometer micrometer-registry-prometheus @@ -53,6 +61,7 @@ grafana/ + grafana-demo/ *.yaml diff --git a/dolphinscheduler-meter/src/main/java/org/apache/dolphinscheduler/meter/MeterConfiguration.java b/dolphinscheduler-meter/src/main/java/org/apache/dolphinscheduler/meter/MeterConfiguration.java index 7fbbecb7e2..7b517f37b7 100644 --- a/dolphinscheduler-meter/src/main/java/org/apache/dolphinscheduler/meter/MeterConfiguration.java +++ b/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; @Configuration -@Profile("meter") @EnableAspectJAutoProxy @EnableAutoConfiguration public class MeterConfiguration { diff --git a/dolphinscheduler-meter/src/main/resources/application-meter.yaml b/dolphinscheduler-meter/src/main/resources/grafana-demo/dashboards/provisioning.yaml similarity index 82% rename from dolphinscheduler-meter/src/main/resources/application-meter.yaml rename to dolphinscheduler-meter/src/main/resources/grafana-demo/dashboards/provisioning.yaml index 7e5335a041..4b14c4849a 100644 --- a/dolphinscheduler-meter/src/main/resources/application-meter.yaml +++ b/dolphinscheduler-meter/src/main/resources/grafana-demo/dashboards/provisioning.yaml @@ -15,13 +15,9 @@ # limitations under the License. # -management: - endpoints: - web: - exposure: - include: '*' - server: - port: 5679 - metrics: - tags: - application: ${spring.application.name} +apiVersion: 1 +providers: + - name: general + folder: 'DolphinScheduler' + options: + path: /dashboards diff --git a/dolphinscheduler-meter/src/main/resources/grafana-demo/datasources/prom.yaml b/dolphinscheduler-meter/src/main/resources/grafana-demo/datasources/prom.yaml new file mode 100644 index 0000000000..c95e5f5f97 --- /dev/null +++ b/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 diff --git a/dolphinscheduler-meter/src/main/resources/grafana-demo/docker-compose.yaml b/dolphinscheduler-meter/src/main/resources/grafana-demo/docker-compose.yaml new file mode 100644 index 0000000000..6705f30644 --- /dev/null +++ b/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: diff --git a/dolphinscheduler-meter/src/main/resources/grafana-demo/prometheus.yml b/dolphinscheduler-meter/src/main/resources/grafana-demo/prometheus.yml new file mode 100644 index 0000000000..751c2da2f6 --- /dev/null +++ b/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 diff --git a/dolphinscheduler-server/pom.xml b/dolphinscheduler-server/pom.xml index a7e9faebb1..a8c20d3c0e 100644 --- a/dolphinscheduler-server/pom.xml +++ b/dolphinscheduler-server/pom.xml @@ -34,6 +34,10 @@ org.apache.dolphinscheduler dolphinscheduler-service + + org.apache.dolphinscheduler + dolphinscheduler-meter + org.apache.dolphinscheduler dolphinscheduler-spi diff --git a/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/MasterServer.java b/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/MasterServer.java index a969dbcbf1..cbc0d6af1e 100644 --- a/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/MasterServer.java +++ b/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.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.WebApplicationType; import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.FilterType; import org.springframework.transaction.annotation.EnableTransactionManagement; -/** - * master server - */ @ComponentScan(value = "org.apache.dolphinscheduler", excludeFilters = { @ComponentScan.Filter(type = FilterType.REGEX, pattern = { "org.apache.dolphinscheduler.server.worker.*", @@ -80,7 +76,7 @@ public class MasterServer implements IStoppable { Thread.currentThread().setName(Constants.THREAD_NAME_MASTER_SERVER); new SpringApplicationBuilder(MasterServer.class) .profiles("master") - .web(WebApplicationType.NONE).run(args); + .run(args); } /** diff --git a/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/WorkerServer.java b/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/WorkerServer.java index 49ad0485af..fd675b082b 100644 --- a/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/WorkerServer.java +++ b/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.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.WebApplicationType; import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.FilterType; @@ -115,7 +114,6 @@ public class WorkerServer implements IStoppable { public static void main(String[] args) { Thread.currentThread().setName(Constants.THREAD_NAME_WORKER_SERVER); new SpringApplicationBuilder(WorkerServer.class) - .web(WebApplicationType.NONE) .profiles("worker") .run(args); } diff --git a/dolphinscheduler-server/src/main/resources/application-master.yaml b/dolphinscheduler-server/src/main/resources/application-master.yaml index 2b7d3f4e34..c1d3a8e187 100644 --- a/dolphinscheduler-server/src/main/resources/application-master.yaml +++ b/dolphinscheduler-server/src/main/resources/application-master.yaml @@ -45,3 +45,15 @@ master: reserved-memory: 0.3 # master cache process definition, default: true cache-process-definition: true + +server: + port: 5679 + +management: + endpoints: + web: + exposure: + include: '*' + metrics: + tags: + application: ${spring.application.name} diff --git a/dolphinscheduler-server/src/main/resources/application-worker.yaml b/dolphinscheduler-server/src/main/resources/application-worker.yaml index 7c18d4f04f..d7bca0929f 100644 --- a/dolphinscheduler-server/src/main/resources/application-worker.yaml +++ b/dolphinscheduler-server/src/main/resources/application-worker.yaml @@ -38,3 +38,15 @@ worker: - default # alert server listen host alert-listen-host: localhost + +server: + port: 1235 + +management: + endpoints: + web: + exposure: + include: '*' + metrics: + tags: + application: ${spring.application.name} diff --git a/dolphinscheduler-standalone-server/src/main/resources/application-standalone.yaml b/dolphinscheduler-standalone-server/src/main/resources/application-standalone.yaml index 5c68f88cb8..532c85a3b3 100644 --- a/dolphinscheduler-standalone-server/src/main/resources/application-standalone.yaml +++ b/dolphinscheduler-standalone-server/src/main/resources/application-standalone.yaml @@ -18,3 +18,17 @@ spring: application: name: standalone-server + +server: + port: 12345 + +management: + endpoints: + web: + exposure: + include: '*' + server: + port: 8080 + metrics: + tags: + application: ${spring.application.name} diff --git a/script/dolphinscheduler-daemon.sh b/script/dolphinscheduler-daemon.sh index 1220e904e8..f895a3bf42 100755 --- a/script/dolphinscheduler-daemon.sh +++ b/script/dolphinscheduler-daemon.sh @@ -61,9 +61,6 @@ export DOLPHINSCHEDULER_OPTS="-server -XX:MetaspaceSize=128m -XX:MaxMetaspaceSiz export dbtype=${dbtype:-"h2"} 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 LOG_FILE="-Dlogging.config=classpath:logback-api.xml"