diff --git a/config/samples/v1beta1_verticaautoscaler_custom_metrics.yaml b/config/samples/v1beta1_verticaautoscaler_custom_metrics.yaml index 585596ba4..323422e5e 100644 --- a/config/samples/v1beta1_verticaautoscaler_custom_metrics.yaml +++ b/config/samples/v1beta1_verticaautoscaler_custom_metrics.yaml @@ -32,3 +32,15 @@ spec: target: type: Value value: "6" + - metric: + type: Object + object: + describedObject: + apiVersion: v1 + kind: Service + name: verticadb-sample-sc1 + metric: + name: vertica_queued_requests_count + target: + type: Value + value: "3" diff --git a/prometheus/adapter.yaml b/prometheus/adapter.yaml index 365f7ada7..68e5b768c 100644 --- a/prometheus/adapter.yaml +++ b/prometheus/adapter.yaml @@ -45,20 +45,15 @@ rules: service: resource: service seriesQuery: vertica_sessions_running_counter{namespace!="", service!= "", type="active", initiator="user"} - # - seriesQuery: 'vertica_sessions_running_counter{namespace!="", pod!=""}' - # resources: - # overrides: - # namespace: - # resource: namespace - # pod: - # resource: pod - # metricsQuery: 'sum(increase(vertica_sessions_running_counter[1m])) by (namespace, pod)' - # # Number of requests that are queued in the resource pool. Type: guage - # - seriesQuery: 'vertica_queued_requests_total{namespace!="", pod!=""}' - # resources: - # overrides: - # namespace: - # resource: namespace - # pod: - # resource: pod - # metricsQuery: 'sum(increase(vertica_queued_requests_total[1m])) by (namespace, pod)' + # Number of requests that are queued in the resource pool. Type: guage + - seriesQuery: 'vertica_queued_requests_total{namespace!="", pod!=""}' + name: + as: ${1}_count + matches: ^(.*)_total$ + resources: + overrides: + namespace: + resource: namespace + pod: + resource: pod + metricsQuery: 'sum(vertica_queued_requests_total) by (namespace, pod)' diff --git a/tests/e2e-leg-12/prometheus-sanity/35-verify-custom-metrics.yaml b/tests/e2e-leg-12/prometheus-sanity/35-verify-custom-metrics.yaml index 2c889894c..844e7ac7a 100644 --- a/tests/e2e-leg-12/prometheus-sanity/35-verify-custom-metrics.yaml +++ b/tests/e2e-leg-12/prometheus-sanity/35-verify-custom-metrics.yaml @@ -40,12 +40,12 @@ commands: echo "empty custom metrics result on vertica_sessions_active_count. Result: $RESULT" exit 1 fi - # - script: | - # NAMESPACE=$(kubectl get pod v-prometheus-pri1-0 -o=jsonpath='{.metadata.namespace}') - # RESULT=$(kubectl get --raw /apis/custom.metrics.k8s.io/v1beta1/namespaces/$NAMESPACE/pods/v-prometheus-pri1-0/vertica_queued_requests_total) - # OUTPUT=$(echo $RESULT | jq -r '.items[0].value') - # # verify the metrics result - # if [[ "$OUTPUT" == "" ]]; then - # echo "empty custom metrics result on vertica_queued_requests_total. Result: $RESULT" - # exit 1 - # fi + - script: | + NAMESPACE=$(kubectl get pod v-prometheus-pri1-0 -o=jsonpath='{.metadata.namespace}') + RESULT=$(kubectl get --raw /apis/custom.metrics.k8s.io/v1beta1/namespaces/$NAMESPACE/pods/v-prometheus-pri1-0/vertica_queued_requests_count) + OUTPUT=$(echo $RESULT | jq -r '.items[0].value') + # verify the metrics result + if [[ "$OUTPUT" == "" ]]; then + echo "empty custom metrics result on vertica_queued_requests_count. Result: $RESULT" + exit 1 + fi