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

Fix 1340 prometheus counters #1375

Merged

Conversation

deepak-muley
Copy link
Contributor

@deepak-muley deepak-muley commented Aug 17, 2021

Due to error in merging, PR #1365 received few changes from master in the history. hence to keep the branch clean, have created this PR. Sorry for the inconvenience.
Ref #1340
@Jeffwan @andreyvelich @johnugeorge

Testing done:

  • Created 2 jobs of tensorflow and deleted one job quickly i saw only following even after long time

HELP training_operator_jobs_created_total Counts number of jobs created
TYPE training_operator_jobs_created_total counter
training_operator_jobs_created_total{framework="tensorflow",job_namespace="test-tf-operator"} 2

HELP training_operator_jobs_successful_total Counts number of jobs successful
TYPE training_operator_jobs_successful_total counter
training_operator_jobs_successful_total{framework="tensorflow",job_namespace="test-tf-operator"} 1

Note: somehow was expecting deletedjob count to go up but it did not. Need more debugging @Jeffwan @andreyvelich

pulling latest changes from kubeflow/tf-operator to deepak-muley/tf-operator
TODO:
1. Decide if we should be renaming the tf_operator specific counters
   (backward compability needed?)
2. Update counters at all other places
TODO:
Need to find out if other files like job.go is needed
@deepak-muley
Copy link
Contributor Author

Also to open up the discussion of how should the counters be named (metrics name vs label) here are current thoughts

Currently we have following:
training_operator_mxjobs_created_total {job_namespace: "ns"}
training_operator_pytorchjobs_created_total {job_namespace: "ns"}
training_operator_tfjobs_created_total {job_namespace: "ns"}
training_operator_xgboostjobs_created_total {job_namespace: "ns"}

training_operator_mxjobs_deleted_total {job_namespace: "ns"}
training_operator_pytorchjobs_deleted_total {job_namespace: "ns"}
training_operator_tfjobs_deleted_total {job_namespace: "ns"}
training_operator_xgboostjobs_deleted_total {job_namespace: "ns"}

training_operator_mxjobs_successful_total {job_namespace: "ns"}
training_operator_pytorchjobs_successful_total {job_namespace: "ns"}
training_operator_tfjobs_successful_total {job_namespace: "ns"}
training_operator_xgboostjobs_successful_total {job_namespace: "ns"}

training_operator_mxjobs_failed_total {job_namespace: "ns"}
training_operator_pytorchjobs_failed_total {job_namespace: "ns"}
training_operator_tfjobs_failed_total {job_namespace: "ns"}
training_operator_xgboostjobs_failed_total {job_namespace: "ns"}

training_operator_mxjobs_restarted_total {job_namespace: "ns"}
training_operator_pytorchjobs_restarted_total {job_namespace: "ns"}
training_operator_tfjobs_restarted_total {job_namespace: "ns"}
training_operator_xgboostjobs_restarted_total {job_namespace: "ns"}

Current suggestion is as follows:
training_operator_jobs_created_total {job_namespace: "ns", framework: "mxnet”}
training_operator_jobs_created_total {job_namespace: "ns", framework: “pytorch”}
training_operator_jobs_created_total {job_namespace: "ns", framework: “tensor flow”}
training_operator_jobs_created_total {job_namespace: "ns", framework: “xgboost”}

training_operator_jobs_deleted_total {job_namespace: "ns", framework: "mxnet”}
training_operator_jobs_deleted_total {job_namespace: "ns", framework: “pytorch”}
training_operator_jobs_deleted_total {job_namespace: "ns", framework: “tensor flow”}
training_operator_jobs_deleted_total {job_namespace: "ns", framework: “xgboost”}

training_operator_jobs_successful_total {job_namespace: "ns", framework: "mxnet”}
training_operator_jobs_successful_total {job_namespace: "ns", framework: “pytorch”}
training_operator_jobs_successful_total {job_namespace: "ns", framework: “tensor flow”}
training_operator_jobs_successful_total {job_namespace: "ns", framework: “xgboost”}

training_operator_jobs_failed_total {job_namespace: "ns", framework: "mxnet”}
training_operator_jobs_failed_total {job_namespace: "ns", framework: “pytorch”}
training_operator_jobs_failed_total {job_namespace: "ns", framework: “tensor flow”}
training_operator_jobs_failed_total {job_namespace: "ns", framework: “xgboost”}

training_operator_jobs_restarted_total {job_namespace: "ns", framework: "mxnet”}
training_operator_jobs_restarted_total {job_namespace: "ns", framework: “pytorch”}
training_operator_jobs_restarted_total {job_namespace: "ns", framework: “tensor flow”}
training_operator_jobs_restarted_total {job_namespace: "ns", framework: “xgboost”}

————
Why not to go then following route where we add type as well in label.
training_operator_jobs_total {job_namespace: "ns", framework: "mxnet”, type: “created”}
training_operator_jobs_total {job_namespace: "ns", framework: "mxnet”, type: “deleted”}
training_operator_jobs_total {job_namespace: "ns", framework: "mxnet”, type: “successful”}
training_operator_jobs_total {job_namespace: "ns", framework: "mxnet”, type: “failed”}
training_operator_jobs_total {job_namespace: "ns", framework: "mxnet”, type: “restarted”}

training_operator_jobs_total {job_namespace: "ns", framework: “tensorflow”, type: “created”}
training_operator_jobs_total {job_namespace: "ns", framework: "tensorflow”, type: “deleted”}
training_operator_jobs_total {job_namespace: "ns", framework: "tensorflow”, type: “successful”}
training_operator_jobs_total {job_namespace: "ns", framework: "tensorflow”, type: “failed”}
training_operator_jobs_total {job_namespace: "ns", framework: "tensorflow”, type: “restarted”}

training_operator_jobs_total {job_namespace: "ns", framework: “pytorch”, type: “created”}
training_operator_jobs_total {job_namespace: "ns", framework: "pytorch”, type: “deleted”}
training_operator_jobs_total {job_namespace: "ns", framework: "pytorch”, type: “successful”}
training_operator_jobs_total {job_namespace: "ns", framework: "pytorch”, type: “failed”}
training_operator_jobs_total {job_namespace: "ns", framework: "pytorch”, type: “restarted”}

training_operator_jobs_total {job_namespace: "ns", framework: “xgboost”, type: “created”}
training_operator_jobs_total {job_namespace: "ns", framework: "xgboost”, type: “deleted”}
training_operator_jobs_total {job_namespace: "ns", framework: "xgboost”, type: “successful”}
training_operator_jobs_total {job_namespace: "ns", framework: "xgboost”, type: “failed”}
training_operator_jobs_total {job_namespace: "ns", framework: "xgboost”, type: “restarted”}

any concerns on 3rd naming convention?

@aws-kf-ci-bot
Copy link
Contributor

Hi @deepak-muley. Thanks for your PR.

I'm waiting for a kubeflow member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@Jeffwan
Copy link
Member

Jeffwan commented Aug 17, 2021

/ok-to-test

@Jeffwan
Copy link
Member

Jeffwan commented Aug 17, 2021

To me, I think option 2 is better?

Option 1. "training_operator_mxjobs_created_total " It might be hard to create dashboard.
Option 3. I think this is not recommended?

When you have a successful request count and a failed request count, the best way to expose this is as one metric for total requests and another metric for failed requests. This makes it easy to calculate the failure ratio. Do not use one metric with a failed or success label. Similarly, with hit or miss for caches, it’s better to have one metric for total and another for hits.

ref: https://prometheus.io/docs/instrumenting/writing_exporters/

Following are the different counters added
training_operator_jobs_created_total {job_namespace: "ns", framework: "mxnet”}
training_operator_jobs_created_total {job_namespace: "ns", framework: “pytorch”}
training_operator_jobs_created_total {job_namespace: "ns", framework: “tensor flow”}
training_operator_jobs_created_total {job_namespace: "ns", framework: “xgboost”}

training_operator_jobs_deleted_total {job_namespace: "ns", framework: "mxnet”}
training_operator_jobs_deleted_total {job_namespace: "ns", framework: “pytorch”}
training_operator_jobs_deleted_total {job_namespace: "ns", framework: “tensor flow”}
training_operator_jobs_deleted_total {job_namespace: "ns", framework: “xgboost”}

training_operator_jobs_successful_total {job_namespace: "ns", framework: "mxnet”}
training_operator_jobs_successful_total {job_namespace: "ns", framework: “pytorch”}
training_operator_jobs_successful_total {job_namespace: "ns", framework: “tensor flow”}
training_operator_jobs_successful_total {job_namespace: "ns", framework: “xgboost”}

training_operator_jobs_failed_total {job_namespace: "ns", framework: "mxnet”}
training_operator_jobs_failed_total {job_namespace: "ns", framework: “pytorch”}
training_operator_jobs_failed_total {job_namespace: "ns", framework: “tensor flow”}
training_operator_jobs_failed_total {job_namespace: "ns", framework: “xgboost”}

training_operator_jobs_restarted_total {job_namespace: "ns", framework: "mxnet”}
training_operator_jobs_restarted_total {job_namespace: "ns", framework: “pytorch”}
training_operator_jobs_restarted_total {job_namespace: "ns", framework: “tensor flow”}
training_operator_jobs_restarted_total {job_namespace: "ns", framework: “xgboost”}
@deepak-muley deepak-muley marked this pull request as ready for review August 18, 2021 05:39
@deepak-muley
Copy link
Contributor Author

/test kubeflow-tf-operator-presubmit

@deepak-muley
Copy link
Contributor Author

To me, I think option 2 is better?

Option 1. "training_operator_mxjobs_created_total " It might be hard to create dashboard.
Option 3. I think this is not recommended?

When you have a successful request count and a failed request count, the best way to expose this is as one metric for total requests and another metric for failed requests. This makes it easy to calculate the failure ratio. Do not use one metric with a failed or success label. Similarly, with hit or miss for caches, it’s better to have one metric for total and another for hits.

ref: https://prometheus.io/docs/instrumenting/writing_exporters/

Per https://prometheus.io/docs/prometheus/latest/querying/basics/ does not really highlight in a clean way of any issue with more labels

@johnugeorge
Copy link
Member

Option 2 looks more intuitive to me. How about starting with Option 2 for now?

@deepak-muley
Copy link
Contributor Author

Yes currently I have pushed the changes with option2

@deepak-muley
Copy link
Contributor Author

/retest

@google-oss-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Jeffwan

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

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@Jeffwan
Copy link
Member

Jeffwan commented Aug 19, 2021

LGTM. leave it to @johnugeorge to double check and approve

@johnugeorge
Copy link
Member

Can you delete previous tfjob prometheus counters? Any reason for keeping it?

tfJobsSuccessCount, tfJobsFailureCount, tfJobsCreatedCount, tfJobsRestartCount

@deepak-muley
Copy link
Contributor Author

They will go away when we remove those files. They are not registered

@johnugeorge
Copy link
Member

Related : #1367

@johnugeorge
Copy link
Member

Thanks @deepak-muley
/lgtm

@google-oss-robot google-oss-robot merged commit 7e69531 into kubeflow:master Aug 19, 2021
@deepak-muley deepak-muley deleted the fix-1340-prometheus-counters branch August 19, 2021 15:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants