You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@linkis.apache.org by pe...@apache.org on 2022/07/16 11:28:00 UTC

[incubator-linkis] 02/03: optimize prometheus configuration

This is an automated email from the ASF dual-hosted git repository.

peacewong pushed a commit to branch dev-1.1.3
in repository https://gitbox.apache.org/repos/asf/incubator-linkis.git

commit 6c67f8140eb10e95dd48bfd47809b22f5f88f92d
Author: casionone <ca...@gmail.com>
AuthorDate: Wed Jul 13 01:13:50 2022 +0800

    optimize prometheus configuration
---
 .../assembly-combined/conf/application-eureka.yml         |  8 ++++++++
 .../assembly-combined/conf/application-linkis.yml         |  6 +++++-
 .../assembly-combined/sbin/common.sh                      | 12 ++++++++++--
 assembly-combined-package/bin/install.sh                  | 15 +++++++--------
 4 files changed, 30 insertions(+), 11 deletions(-)

diff --git a/assembly-combined-package/assembly-combined/conf/application-eureka.yml b/assembly-combined-package/assembly-combined/conf/application-eureka.yml
index d87970800..605d0bb4d 100644
--- a/assembly-combined-package/assembly-combined/conf/application-eureka.yml
+++ b/assembly-combined-package/assembly-combined/conf/application-eureka.yml
@@ -25,6 +25,8 @@ server:
   response-cache-update-interval-ms: 2000
 eureka:
   instance:
+    metadata-map:
+      prometheus.path: ${prometheus.path:/actuator/prometheus}
     hostname:
 #    preferIpAddress: true
   client:
@@ -32,3 +34,9 @@ eureka:
 #    fetch-registry: false
     serviceUrl:
       defaultZone: http://127.0.0.1:20303/eureka/
+
+management:
+  endpoints:
+    web:
+      exposure:
+        include: refresh,info,health,metrics
\ No newline at end of file
diff --git a/assembly-combined-package/assembly-combined/conf/application-linkis.yml b/assembly-combined-package/assembly-combined/conf/application-linkis.yml
index f886ad974..a39c9d999 100644
--- a/assembly-combined-package/assembly-combined/conf/application-linkis.yml
+++ b/assembly-combined-package/assembly-combined/conf/application-linkis.yml
@@ -14,6 +14,9 @@
 #
 
 eureka:
+  instance:
+    metadata-map:
+      prometheus.path: ${prometheus.path:${prometheus.endpoint}}
   client:
     serviceUrl:
       defaultZone: http://127.0.0.1:20303/eureka/
@@ -21,7 +24,8 @@ management:
   endpoints:
     web:
       exposure:
-        include: refresh,info
+        include: refresh,info,health,metrics
+
 logging:
   config: classpath:log4j2.xml
 
diff --git a/assembly-combined-package/assembly-combined/sbin/common.sh b/assembly-combined-package/assembly-combined/sbin/common.sh
index 9ed635698..4278507f9 100644
--- a/assembly-combined-package/assembly-combined/sbin/common.sh
+++ b/assembly-combined-package/assembly-combined/sbin/common.sh
@@ -21,6 +21,12 @@ export local_host="`hostname --fqdn`"
 
 ipaddr=$(ip addr | awk '/^[0-9]+: / {}; /inet.*global/ {print gensub(/(.*)\/(.*)/, "\\1", "g", $2)}')
 
+## color
+RED='\033[0;31m'
+NC='\033[0m' # No Color
+GREEN='\033[0;32m'
+#used as: echo -e "Apache ${RED}Linkis ${NC} Test \n"
+
 function isLocal(){
     if [ "$1" == "127.0.0.1" ];then
         return 0
@@ -65,9 +71,11 @@ function copyFile(){
 
 function isSuccess(){
 if [ $? -ne 0 ]; then
-    echo "Failed to " + $1
+    echo -e "${RED}Failed${NC} to $1"
+    echo ""
     exit 1
 else
-    echo "Succeed to" + $1
+    echo -e "${GREEN}Succeed${NC} to $1"
+    echo ""
 fi
 }
\ No newline at end of file
diff --git a/assembly-combined-package/bin/install.sh b/assembly-combined-package/bin/install.sh
index 9d31c627a..ce0e5ce77 100644
--- a/assembly-combined-package/bin/install.sh
+++ b/assembly-combined-package/bin/install.sh
@@ -80,10 +80,11 @@ if [  -d $LINKIS_HOME ] && [ "$LINKIS_HOME" != "$workDir" ];then
 
    ## Every time, backup the old linkis home with timestamp and not clean them.
    ## If you want to clean them, please delete them manually.
-   curTs=`date +'%s'`
-   echo "mv  $LINKIS_HOME  $LINKIS_HOME-$curTs"
-   mv  $LINKIS_HOME  $LINKIS_HOME-$curTs
-   isSuccess "back up old LINKIS_HOME:$LINKIS_HOME to $LINKIS_HOME-$curTs"
+   backDir=$LINKIS_HOME-back-`date +'%s'`
+
+   echo "mv  $LINKIS_HOME  $backDir"
+   mv  $LINKIS_HOME  $backDir
+   isSuccess "back up old LINKIS_HOME:$LINKIS_HOME to $backDir"
 fi
 echo "try to create dir LINKIS_HOME: $LINKIS_HOME"
 sudo mkdir -p $LINKIS_HOME;sudo chown -R $deployUser:$deployUser $LINKIS_HOME
@@ -428,10 +429,8 @@ if [ "true" == "$PROMETHEUS_ENABLE" ]
 then
   echo "prometheus is enabled"
   sed -i ${txt}  "s#\#wds.linkis.prometheus.enable.*#wds.linkis.prometheus.enable=true#g" $common_conf
-  sed -i ${txt}  '/eureka:/a \\  instance:\n    metadata-map:\n      prometheus.path: ${prometheus.path:${prometheus.endpoint}}' $LINKIS_HOME/conf/application-linkis.yml
-  sed -i ${txt}  's#include: refresh,info#include: refresh,info,health,metrics,prometheus#g' $LINKIS_HOME/conf/application-linkis.yml
-  sed -i ${txt} '/instance:/a \    metadata-map:\n      prometheus.path: ${prometheus.path:/actuator/prometheus}' $LINKIS_HOME/conf/application-eureka.yml
-  sed -i ${txt} '$a \\nmanagement:\n  endpoints:\n    web:\n      exposure:\n        include: refresh,info,health,metrics,prometheus' $LINKIS_HOME/conf/application-eureka.yml
+  sed -i ${txt}  's#include: refresh,info.*#include: refresh,info,health,metrics,prometheus#g' $LINKIS_HOME/conf/application-linkis.yml
+  sed -i ${txt}  's#include: refresh,info.*#include: refresh,info,health,metrics,prometheus#g' $LINKIS_HOME/conf/application-eureka.yml
 fi
 
 echo "preveliges linkis command shells"


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@linkis.apache.org
For additional commands, e-mail: commits-help@linkis.apache.org