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

ansible: add custom resource metrics #1723

Merged
merged 5 commits into from
Aug 20, 2019

Conversation

djzager
Copy link
Contributor

@djzager djzager commented Jul 22, 2019

Description of the change:

This PR enables custom resource metrics for ansible based operators.

Motivation for the change:

Closes #1554

@openshift-ci-robot openshift-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jul 22, 2019
@openshift-ci-robot openshift-ci-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Jul 22, 2019
@djzager
Copy link
Contributor Author

djzager commented Jul 23, 2019

/retest

3 similar comments
@djzager
Copy link
Contributor Author

djzager commented Jul 23, 2019

/retest

@djzager
Copy link
Contributor Author

djzager commented Jul 23, 2019

/retest

@djzager
Copy link
Contributor Author

djzager commented Jul 24, 2019

/retest

@djzager
Copy link
Contributor Author

djzager commented Jul 24, 2019

/test e2e-aws-ansible

Copy link
Member

@lilic lilic left a comment

Choose a reason for hiding this comment

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

lgtm overall, thanks!

fi

# verify that the metrics endpoint exists
if ! timeout 1m bash -c -- "until kubectl run -it --rm --restart=Never test-metrics --image=registry.access.redhat.com/ubi7/ubi-minimal:latest -- curl -sfo /dev/null http://memcached-operator-metrics:8383/metrics; do sleep 1; done";
Copy link
Member

Choose a reason for hiding this comment

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

I believe you asked on slack how to test custom resource metrics.

So this is for the controller-runtime metrics, you could add the same test for the custom resource metrics, so seeing if the metrics exists on 8686 port.

Another thing you could do is, we know exactly what the metrics data will be so you could curl the endpoint and compare the result to a predefined string. If you look at the go e2e test you can see how the metrics data would look like here

Metric:
# HELP memcached_info Information about the Memcached operator replica.
# TYPE memcached_info gauge
memcached_info{namespace="memcached-memcached-group-cluster-1553683239",memcached="example-memcached"} 1

Hope that makes sense, otherwise feel free to ask any questions!

Copy link
Member

Choose a reason for hiding this comment

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

Note that the verification needs to happen after line 79, so after creating CR instance. As that is when the metric should be 1.

Copy link
Member

Choose a reason for hiding this comment

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

I think we wanted to add the same check for the other metrics port so port 8686.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I believe I was able to manage it the check for port 8686 and for the CR info. Not having much experience with these metrics I just used grep. Let me know what you think. Thank you for the help.

@theishshah
Copy link
Member

LGTM once Travis is passing, will take a deeper dive to see why it's failing

@theishshah theishshah self-requested a review July 31, 2019 15:31
Copy link
Member

@joelanford joelanford left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@lilic lilic left a comment

Choose a reason for hiding this comment

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

Otherwise lgtm, thanks for this!

fi

# verify that the metrics endpoint exists
if ! timeout 1m bash -c -- "until kubectl run -it --rm --restart=Never test-metrics --image=registry.access.redhat.com/ubi7/ubi-minimal:latest -- curl -sfo /dev/null http://memcached-operator-metrics:8383/metrics; do sleep 1; done";
Copy link
Member

Choose a reason for hiding this comment

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

I think we wanted to add the same check for the other metrics port so port 8686.

@theishshah
Copy link
Member

Hi David, just wanted to touch back to see if you have an idea for when you can get the last couple of nits so we can close/merge this?

@djzager
Copy link
Contributor Author

djzager commented Aug 16, 2019

Hi David, just wanted to touch back to see if you have an idea for when you can get the last couple of nits so we can close/merge this?

Perfect timing 😎. I've been struggling to get back to this but I have this afternoon to work on it. If you've seen no changes by Tuesday then I've messed up.

@djzager djzager force-pushed the ao-custom-metrics branch 2 times, most recently from 9034fac to 4ab0ba0 Compare August 17, 2019 02:11
@djzager djzager changed the title WIP ansible: add custom resource metrics ansible: add custom resource metrics Aug 19, 2019
@openshift-ci-robot openshift-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Aug 19, 2019
@djzager
Copy link
Contributor Author

djzager commented Aug 19, 2019

Figuring out the check and then this will be ready.

@djzager
Copy link
Contributor Author

djzager commented Aug 19, 2019

/retest

2 similar comments
@djzager
Copy link
Contributor Author

djzager commented Aug 19, 2019

/retest

@djzager
Copy link
Contributor Author

djzager commented Aug 19, 2019

/retest

@djzager
Copy link
Contributor Author

djzager commented Aug 19, 2019

/test e2e-aws-ansible

In the Ansible Operator tests, we should verify that the metrics reflect
that an instance of the memcached resource has been created.

Also add the change to the Changelog.
@djzager
Copy link
Contributor Author

djzager commented Aug 20, 2019

@joelanford @theishshah I believe this is ready to go. Thank you for your patience.

Copy link
Member

@theishshah theishshah left a comment

Choose a reason for hiding this comment

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

lgtm thanks!

@theishshah theishshah merged commit abac23c into operator-framework:master Aug 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Enable custom resource metrics in helm and ansible
5 participants