project-codeflare / multi-cluster-app-dispatcher

Holistic job manager on Kubernetes
Apache License 2.0
108 stars 63 forks source link

Add a metric of AppWrappers counts per state #675

Open ronensc opened 1 year ago

ronensc commented 1 year ago

Issue link

Closes #674

What changes have been made

This PR adds a custom metric to expose how many AppWrappers are per state. It is built on top of #651. To review only the delta, skip the first 3 commits in this PR.

Verification steps

Same as mentioned in #651, I checked that the metrics are available in the codeflare-operator operator by running it:

# in codeflare-operator root
go mod edit -replace github.com/project-codeflare/multi-cluster-app-dispatcher=../multi-cluster-app-dispatcher
make build
NAMESPACE=default go run ./main.go -kubeconfig <path-to-kubeconfig>

and in a new shell:

curl localhost:8080/metrics | grep appwrappers_count

# HELP mcad_appwrappers_count AppWrappers count per state
# TYPE mcad_appwrappers_count gauge
mcad_appwrappers_count{state="Completed"} 0
mcad_appwrappers_count{state="Deleted"} 0
mcad_appwrappers_count{state="Failed"} 0
mcad_appwrappers_count{state="Pending"} 0
mcad_appwrappers_count{state="Running"} 1
mcad_appwrappers_count{state="RunningHoldCompletion"} 0

To see the counts change, I created a sample AppWrapper:

# in MCAD root
kubectl apply -f doc/usage/aw-01.yaml

Checks

openshift-ci[bot] commented 1 year ago

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: Once this PR has been reviewed and has the lgtm label, please assign asm582 for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files: - **[OWNERS](https://github.com/project-codeflare/multi-cluster-app-dispatcher/blob/main/OWNERS)** Approvers can indicate their approval by writing `/approve` in a comment Approvers can cancel approval by writing `/approve cancel` in a comment