Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add new object metric and fix e2e test #1035

Merged
merged 2 commits into from
Jan 17, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion prometheus/adapter.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,18 @@ rules:
pod:
resource: pod
metricsQuery: 'avg_over_time(vertica_process_memory_usage_percent[60m])'
# # Number of active sessions. Type: guage
# Total number of active sessions. Type: guage
- metricsQuery: sum(vertica_sessions_running_counter{namespace!="", service!= "", type="active", initiator="user"}) by (namespace, service)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- metricsQuery: sum(vertica_sessions_running_counter{namespace!="", service!= "", type="active", initiator="user"}) by (namespace, service)
- metricsQuery: sum(vertica_sessions_running_counter{type="active"}) by (namespace, service)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same comment as above.

name:
as: ${1}_active_count
matches: ^(.*)_running_counter$
resources:
overrides:
namespace:
resource: namespace
service:
resource: service
seriesQuery: vertica_sessions_running_counter{namespace!="", service!= "", type="active", initiator="user"}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
seriesQuery: vertica_sessions_running_counter{namespace!="", service!= "", type="active", initiator="user"}
seriesQuery: vertica_sessions_running_counter{namespace!="", service!= "", type="active"}

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are a lot of sessions which are initiated by the system. Those numbers are pretty large. We have to exclude those from calculating this metric.

# - seriesQuery: 'vertica_sessions_running_counter{namespace!="", pod!=""}'
# resources:
# overrides:
Expand Down
21 changes: 10 additions & 11 deletions tests/e2e-leg-12/prometheus-sanity/35-verify-custom-metrics.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ apiVersion: kuttl.dev/v1beta1
kind: TestStep
commands:
- script: |
NAMESPACE=$(kubectl get pod v-prometheus-pri1-0 -o=jsonpath='{.metadata.namespace}')
echo "sleep 120 seconds before starting to verify metrics"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need this sleep.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It took me a lot of time to debug the failure. The metric is not available right away after the adapter is installed. We have to wait some time. We need it.

sleep 120
RESULT=$(kubectl get --raw /apis/custom.metrics.k8s.io/v1beta1/namespaces/$NAMESPACE/pods/v-prometheus-pri1-0/vertica_cpu_aggregate_usage_percentage)
OUTPUT=$(echo $RESULT | jq -r '.items[0].value')
# verify the metrics result
Expand All @@ -24,23 +25,21 @@ commands:
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_process_memory_usage_percent)
OUTPUT=$(echo $RESULT | jq -r '.items[0].value')
# verify the metrics result
if [[ "$OUTPUT" == "" ]]; then
echo "empty custom metrics result on vertica_process_memory_usage_percent. 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_sessions_running_counter)
# OUTPUT=$(echo $RESULT | jq -r '.items[0].value')
# # verify the metrics result
# if [[ "$OUTPUT" == "" ]]; then
# echo "empty custom metrics result on vertica_sessions_running_counter. Result: $RESULT"
# exit 1
# fi
- script: |
RESULT=$(kubectl get --raw /apis/custom.metrics.k8s.io/v1beta1/namespaces/$NAMESPACE/service/v-prometheus-pri1/vertica_sessions_active_count)
OUTPUT=$(echo $RESULT | jq -r '.items[0].value')
# verify the metrics result
if [[ "$OUTPUT" == "" ]]; then
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)
Expand Down
Loading