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

feat: Provide Prometheus metrics for total number of custom resources. #3719

Merged
merged 14 commits into from
Nov 7, 2022

Conversation

v-shenoy
Copy link
Contributor

@v-shenoy v-shenoy commented Oct 2, 2022

Docs PR - kedacore/keda-docs#954

Checklist

  • Commits are signed with Developer Certificate of Origin (DCO - learn more)
  • Tests have been added
  • A PR is opened to update the documentation on (repo) (if applicable)
  • Changelog has been updated and is aligned with our changelog requirements

Relates to #2637, #2638, #2639

@v-shenoy v-shenoy requested a review from a team as a code owner October 2, 2022 19:09
@v-shenoy
Copy link
Contributor Author

v-shenoy commented Oct 2, 2022

I'll update the tests and the docs after I also send PRs for #2637, #2638, if it's alright?
@JorTurFer @tomkerkhove

@tomkerkhove
Copy link
Member

tomkerkhove commented Oct 3, 2022

Fine for me. Changed PR description not to close the issue

@v-shenoy
Copy link
Contributor Author

v-shenoy commented Oct 3, 2022

I'll update the tests and the docs after I also send PRs for #2637, #2638, if it's alright? @JorTurFer @tomkerkhove

I'll be sending that PR after this one has been merged as it'll build on some changes I made here.

@v-shenoy
Copy link
Contributor Author

v-shenoy commented Oct 5, 2022

@JorTurFer @tomkerkhove Any thoughts on this PR? I need this to be merged before working on the others as it will build on the changes here. Don't want to duplicate them across PRs.

@JorTurFer
Copy link
Member

Sorry, I'm a bit busy atm, I'll take a look today or max tomorrow :(

Copy link
Member

@JorTurFer JorTurFer left a comment

Choose a reason for hiding this comment

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

Looking good
Can we add this new metric to the metrics e2e test?

@v-shenoy
Copy link
Contributor Author

v-shenoy commented Oct 7, 2022

Looking good Can we add this new metric to the metrics e2e test?

I was planning on updating tests after adding prometheus metrics for all CRDs.

@v-shenoy
Copy link
Contributor Author

v-shenoy commented Oct 7, 2022

Yeah, I think a finalizer would be a "cleaner" solution. Also helps in futureproofing, if more complex metrics / features are to be added.

@v-shenoy
Copy link
Contributor Author

v-shenoy commented Oct 7, 2022

Actually, never mind. I'll just try to do all crd metrics and e2e test in this PR itself considering they're very coupled. @JorTurFer

@JorTurFer
Copy link
Member

Actually, never mind. I'll just try to do all crd metrics and e2e test in this PR itself considering they're very coupled. @JorTurFer

No worries, you can add the e2e test in another PR with all the metrics

@JorTurFer
Copy link
Member

My only concern is about the finalizer, maybe we should add it due to is clearer, atm we are already using them in other resources. WDYT @zroubalik ? Is this an overkill?

@v-shenoy
Copy link
Contributor Author

v-shenoy commented Oct 7, 2022

My only concern is about the finalizer, maybe we should add it due to is clearer, atm we are already using them in other resources. WDYT @zroubalik ? Is this an overkill?

I also agree that the finalizers are cleaner than calling the method under the error block.

@v-shenoy
Copy link
Contributor Author

v-shenoy commented Oct 7, 2022

Added metrics for all custom resources - SOs, SJs, TAs, CTAs, and updated the e2e test as well.

@v-shenoy v-shenoy changed the title feat: Provide Prometheus metrics for total numer of (Cluster)TriggerAuthentication objects feat: Provide Prometheus metrics for total number of custom resources. Oct 7, 2022
@v-shenoy
Copy link
Contributor Author

v-shenoy commented Oct 7, 2022

Docs PR - kedacore/keda-docs#954

Copy link
Member

@JorTurFer JorTurFer left a comment

Choose a reason for hiding this comment

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

Looking good
Could you move new finalizers to split files (like in case of so/sj). It's the code it's clearer 😄

@v-shenoy
Copy link
Contributor Author

v-shenoy commented Oct 8, 2022

/run-e2e
Update: You can check the progress here

@v-shenoy
Copy link
Contributor Author

v-shenoy commented Oct 8, 2022

Looking good Could you move new finalizers to split files (like in case of so/sj). It's the code it's clearer 😄

Moved them to separate files.

Had to pull out code into common functions because the linter was complaining about duplicate code. Struggled a bit with the Go type system, before declaring an interface that both reconcilers satisfy to avoid having ugly switch cases in the common code.

Copy link
Member

@JorTurFer JorTurFer left a comment

Choose a reason for hiding this comment

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

LGTM!
Awesome job ❤️
Due to there are changes in the controllers part, let's wait till @zroubalik takes a look too

Copy link
Member

@tomkerkhove tomkerkhove left a comment

Choose a reason for hiding this comment

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

See kedacore/keda-docs#954 (comment) but basically I think it's a lot more user-friendly if we have 4 metrics:

  • keda_operator_scaledobject_totals - Total number of KEDA ScaledObjects per namespace resources.
  • keda_operator_scaledjobs_totals - Total number of KEDA ScaledJobs per namespace resources.
  • keda_operator_triggerauthentication_totals - Total number of KEDA TriggerAuthentication per namespace resources.
  • keda_operator_clustertriggerauthentication_totals - Total number of KEDA ClusterTriggerAuthentication resources.

@tomkerkhove
Copy link
Member

See kedacore/keda-docs#954 (comment) but basically I think it's a lot more user-friendly if we have 4 metrics:

  • keda_operator_scaledobject_totals - Total number of KEDA ScaledObjects per namespace resources.
  • keda_operator_scaledjobs_totals - Total number of KEDA ScaledJobs per namespace resources.
  • keda_operator_triggerauthentication_totals - Total number of KEDA TriggerAuthentication per namespace resources.
  • keda_operator_clustertriggerauthentication_totals - Total number of KEDA ClusterTriggerAuthentication resources.

@JorTurFer @zroubalik can you please share your thoughts on this so that we can make the changes that are required (if need be)?

@JorTurFer
Copy link
Member

See kedacore/keda-docs#954 (comment) but basically I think it's a lot more user-friendly if we have 4 metrics:

  • keda_operator_scaledobject_totals - Total number of KEDA ScaledObjects per namespace resources.
  • keda_operator_scaledjobs_totals - Total number of KEDA ScaledJobs per namespace resources.
  • keda_operator_triggerauthentication_totals - Total number of KEDA TriggerAuthentication per namespace resources.
  • keda_operator_clustertriggerauthentication_totals - Total number of KEDA ClusterTriggerAuthentication resources.

@JorTurFer @zroubalik can you please share your thoughts on this so that we can make the changes that are required (if need be)?

Let's discuss in the docs PR directly to have only one thread about this 😄

CHANGELOG.md Outdated Show resolved Hide resolved
Signed-off-by: Vighnesh Shenoy <vshenoy@microsoft.com>
Signed-off-by: Vighnesh Shenoy <vshenoy@microsoft.com>
Signed-off-by: Vighnesh Shenoy <vshenoy@microsoft.com>
Signed-off-by: Vighnesh Shenoy <vshenoy@microsoft.com>
Signed-off-by: Vighnesh Shenoy <vshenoy@microsoft.com>
Signed-off-by: Vighnesh Shenoy <vshenoy@microsoft.com>
Signed-off-by: Vighnesh Shenoy <vshenoy@microsoft.com>
Signed-off-by: Vighnesh Shenoy <vshenoy@microsoft.com>
Signed-off-by: Vighnesh Shenoy <vshenoy@microsoft.com>
Signed-off-by: Vighnesh Shenoy <vshenoy@microsoft.com>
Signed-off-by: Vighnesh Shenoy <vshenoy@microsoft.com>
Copy link
Member

@zroubalik zroubalik left a comment

Choose a reason for hiding this comment

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

Looking good! just a small nit about using constants as suggested in CTA_controller.

Signed-off-by: Vighnesh Shenoy <vshenoy@microsoft.com>
@zroubalik
Copy link
Member

zroubalik commented Nov 4, 2022

/run-e2e prometheus*
Update: You can check the progress here

Copy link
Member

@zroubalik zroubalik left a comment

Choose a reason for hiding this comment

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

great feature!

Signed-off-by: Vighnesh Shenoy <vshenoy@microsoft.com>
@v-shenoy
Copy link
Contributor Author

v-shenoy commented Nov 4, 2022

/run-e2e prometheus*
Update: You can check the progress here

@JorTurFer
Copy link
Member

JorTurFer commented Nov 5, 2022

/run-e2e prometheus*
Update: You can check the progress here

@v-shenoy
Copy link
Contributor Author

v-shenoy commented Nov 7, 2022

Can this be merged now? @JorTurFer

@JorTurFer
Copy link
Member

yes, sorry, this was ready to be merged

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants