Skip to content

Commit

Permalink
Update configurations for Prometheus
Browse files Browse the repository at this point in the history
  • Loading branch information
sgayangi committed Feb 29, 2024
1 parent 9d784a8 commit 10deafd
Show file tree
Hide file tree
Showing 11 changed files with 52 additions and 105 deletions.
2 changes: 1 addition & 1 deletion common-controller/internal/config/default_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ var defaultConfig = &Config{
Metrics: metrics{
Enabled: true,
Type: "prometheus",
Port: 18009,
Port: 18010,
CollectionInterval: 5,
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ spec:
{{ if and .Values.wso2.apk.metrics .Values.wso2.apk.metrics.enabled }}
- containerPort: 18008
protocol: "TCP"
- containerPort: 18010
- containerPort: 18009
protocol: "TCP"
{{ end }}
readinessProbe:
Expand All @@ -67,16 +67,16 @@ spec:
- mountPath: /home/wso2apk/config-deployer/conf/Config.toml
name: config-toml-volume
subPath: Config.toml
- name: prometheus-jmx-config-volume
mountPath: /tmp/metrics/prometheus-jmx-config-configds.yml
subPath: prometheus-jmx-config-configds.yml
- name: config-ds-tls-volume
mountPath: /home/wso2apk/config-deployer/security/config.key
{{- if and .Values.wso2.apk.dp.configdeployer.configs .Values.wso2.apk.dp.configdeployer.configs.tls }}
subPath: {{ .Values.wso2.apk.dp.configdeployer.configs.tls.certKeyFilename | default "tls.key" }}
{{- else }}
subPath: tls.key
{{- end }}
- name: prometheus-jmx-config-volume
mountPath: /tmp/metrics/prometheus-jmx-config-configds.yml
subPath: prometheus-jmx-config-configds.yml
- name: config-ds-tls-volume
mountPath: /home/wso2apk/config-deployer/security/config.pem
{{- if and .Values.wso2.apk.dp.configdeployer.configs .Values.wso2.apk.dp.configdeployer.configs.tls }}
Expand Down Expand Up @@ -114,8 +114,8 @@ spec:
- name: config-toml-volume
configMap:
name: {{ template "apk-helm.resource.prefix" . }}-config-ds-configmap
- name: prometheus-jmx-config-volume
configMap:
- name: prometheus-jmx-config-volume
configMap:
name: prometheus-jmx-config-configds
- name: config-ds-tls-volume
secret:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,25 +23,9 @@ data:
lowercaseOutputName: true
lowercaseOutputLabelNames: true
rules:
# WSO2 APK related metrics
- pattern: 'org.wso2.apk.config<type=ExtAuthMetrics><>total_request_count: (.*)'
name: org_wso2_apk_config_request_count_total
help: "WSO2 APK config total request count."
attrNameSnakeCase: true
type: COUNTER
- pattern: 'org.wso2.apk.config<type=ExtAuthMetrics><>(average_response_time_millis|max_response_time_millis|min_response_time_millis|request_count_in_last_five_minute_window|request_count_window_start_time_millis): (.*)'
name: org_wso2_apk_config_$1
help: "WSO2 APK config $1."
attrNameSnakeCase: true
type: GAUGE
- pattern: 'org.wso2.apk.config<type=ThreadPoolConfig><>(\w+): (.*)'
name: org_wso2_apk_config_thread_pool_$1
help: "WSO2 APK config thread pool $1."
attrNameSnakeCase: true
type: GAUGE
# OS related metrics
- pattern: 'java.lang<type=OperatingSystem><>(\w+): (.*)'
name: os_$1
help: Operating System $1
attrNameSnakeCase: true
type: GAUGE
type: GAUGE
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,4 @@ spec:
- name: servlet-https
protocol: TCP
port: 9443
{{ if and .Values.wso2.apk.metrics .Values.wso2.apk.metrics.enabled }}
- name: prometheus-config-ds-port-lang
protocol: TCP
port: 18008
- name: prometheus-config-ds-port-system
protocol: TCP
port: 18010
{{ end }}
{{- end -}}
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,4 @@ spec:
- name: profile-port
protocol: TCP
port: 6060
{{ if and .Values.wso2.apk.metrics .Values.wso2.apk.metrics.enabled}}
- name: prometheus-adapter-port
port: 18006
protocol: "TCP"
{{ end }}
{{- end -}}
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ spec:
- containerPort: 18003
protocol: TCP
{{ if and .Values.wso2.apk.metrics .Values.wso2.apk.metrics.enabled }}
- containerPort: 18009
- containerPort: 18010
protocol: "TCP"
{{ end }}
{{ include "apk-helm.deployment.resources" .Values.wso2.apk.dp.commonController.deployment.resources | indent 10 }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,4 @@ spec:
- name: https-internal-api
protocol: TCP
port: 18003
{{ if and .Values.wso2.apk.metrics .Values.wso2.apk.metrics.enabled }}
- name: prometheus-common-controller-port
protocol: TCP
port: 18009
{{ end }}
{{- end -}}
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,4 @@ spec:
- name: servlet-https
protocol: TCP
port: 9092
{{- if and .Values.wso2.apk.metrics .Values.wso2.apk.metrics.enabled }}
- name: prometheus-enforcer-port
protocol: TCP
port: 18007
{{- end }}
{{- end -}}
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
# Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com) All Rights Reserved.
#
# WSO2 LLC. 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: v1
kind: ConfigMap
metadata:
Expand Down

This file was deleted.

53 changes: 27 additions & 26 deletions runtime/config-deployer-service/docker/config-deployer/config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,26 @@
PRG="$0"

while [ -h "$PRG" ]; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '.*/.*' > /dev/null; then
ls=$(ls -ld "$PRG")
link=$(expr "$ls" : '.*-> \(.*\)$')
if expr "$link" : '.*/.*' >/dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`/"$link"
PRG=$(dirname "$PRG")/"$link"
fi
done

# Get standard environment variables
PRGDIR=`dirname "$PRG"`
PRGDIR=$(dirname "$PRG")

[ -z "$RUNTIME_HOME" ] && RUNTIME_HOME=`cd "$PRGDIR" ; pwd`
[ -z "$RUNTIME_HOME" ] && RUNTIME_HOME=$(
cd "$PRGDIR"
pwd
)

if [ -z "$JAVACMD" ] ; then
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
if [ -z "$JAVACMD" ]; then
if [ -n "$JAVA_HOME" ]; then
if [ -x "$JAVA_HOME/jre/sh/java" ]; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
Expand All @@ -29,7 +32,7 @@ if [ -z "$JAVACMD" ] ; then
fi
fi

if [ ! -x "$JAVACMD" ] ; then
if [ ! -x "$JAVACMD" ]; then
echo "Error: JAVA_HOME is not defined correctly."
echo " Admin cannot execute $JAVACMD"
exit 1
Expand All @@ -42,16 +45,15 @@ if [ -z "$JAVA_HOME" ]; then
fi
# ----- Process the input command ----------------------------------------------
args=""
for c in $*
do
if [ "$c" = "--debug" ] || [ "$c" = "-debug" ] || [ "$c" = "debug" ]; then
CMD="--debug"
continue
elif [ "$CMD" = "--debug" ]; then
if [ -z "$PORT" ]; then
PORT=$c
fi
for c in $*; do
if [ "$c" = "--debug" ] || [ "$c" = "-debug" ] || [ "$c" = "debug" ]; then
CMD="--debug"
continue
elif [ "$CMD" = "--debug" ]; then
if [ -z "$PORT" ]; then
PORT=$c
fi
fi
done

if [ "$CMD" = "--debug" ]; then
Expand All @@ -69,11 +71,10 @@ fi

CLASSPATH=""
if [ -e "$JAVA_HOME/lib/tools.jar" ]; then
CLASSPATH="$JAVA_HOME/lib/tools.jar"
CLASSPATH="$JAVA_HOME/lib/tools.jar"
fi
for t in "$RUNTIME_HOME"/lib/*.jar
do
CLASSPATH="$CLASSPATH":$t
for t in "$RUNTIME_HOME"/lib/*.jar; do
CLASSPATH="$CLASSPATH":$t
done

# ----- Execute The Requested Command -----------------------------------------
Expand All @@ -85,15 +86,15 @@ cd "$RUNTIME_HOME"

TMP_DIR="$RUNTIME_HOME"/tmp
if [ -d "$TMP_DIR" ]; then
rm -rf "$TMP_DIR"/*
rm -rf "$TMP_DIR"/*
fi

START_EXIT_STATUS=121
status=$START_EXIT_STATUS

if [ -z "$JVM_MEM_OPTS" ]; then
java_version=$("$JAVACMD" -version 2>&1 | awk -F '"' '/version/ {print $2}')
JVM_MEM_OPTS="-Xms256m -Xmx1024m"
java_version=$("$JAVACMD" -version 2>&1 | awk -F '"' '/version/ {print $2}')
JVM_MEM_OPTS="-Xms256m -Xmx1024m"
fi
echo "Using Java memory options: $JVM_MEM_OPTS"

Expand Down

0 comments on commit 10deafd

Please sign in to comment.