operator-sdk icon indicating copy to clipboard operation
operator-sdk copied to clipboard

Add a metric to the sample memcached-operator

Open assafad opened this issue 2 years ago • 2 comments

Description of the change: This PR adds to the sample memcached-operator (testdata/go/v3/memcached-operator) a metric named memcached_number_of_replicas_reconcile_count_total as part of a new monitoring directory. This metric counts the number of times in which the reconcile function updates the Memcached deployment size to equal the desired size spec.
This PR includes scaffolding for this changes, within the existing sample memcached-operator scaffolding (i.e. make generate generates this functionally).

Motivation for the change: We would like to implement observability concepts for the memcahced-operator, in order to have the operator in Deep Insights capability level. Then, we may use it as a reference in an observability best-practices tutorial in Operator-SDK. This metric would be the first step towards this goal.

Checklist

If the pull request includes user-facing changes, extra documentation is required:

Signed-off-by: assafad [email protected]

assafad avatar Aug 04 '22 14:08 assafad

/hold

assafad avatar Aug 04 '22 15:08 assafad

/unhold

assafad avatar Aug 07 '22 07:08 assafad

/hold cancel

It shows nice to get reviews now.

camilamacedo86 avatar Aug 16 '22 14:08 camilamacedo86

So, the idea would be to link the example on the docs. WDYT? Are you OK with adding the example in the mock sample?

This is fine by me. For the most part we use the mock sample for tutorials in the documentation so it makes sense to update it if the idea is to link to this in the documentation.

everettraven avatar Aug 16 '22 17:08 everettraven

/hold

assafad avatar Aug 18 '22 11:08 assafad

Before merging, we need to make sure we fix the reason for the sanity check failure. I think it should be fixed by a go mod tidy followed by a commit and push

everettraven avatar Aug 18 '22 13:08 everettraven

/unhold

assafad avatar Aug 23 '22 09:08 assafad

/retest

assafad avatar Aug 23 '22 09:08 assafad

@assafad: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.

In response to this:

/retest

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.

openshift-ci[bot] avatar Aug 23 '22 09:08 openshift-ci[bot]

Before merging, we need to make sure we fix the reason for the sanity check failure. I think it should be fixed by a go mod tidy followed by a commit and push

Hi @everettraven, I did go mod tidy but it seems that DCO is still failing. Any idea why?

assafad avatar Aug 23 '22 10:08 assafad

Hi @assafad,

Before merging, we need to make sure we fix the reason for the sanity check failure. I think it should be fixed by a go mod tidy followed by a commit and push

Hi @everettraven, I did go mod tidy but it seems that DCO is still failing. Any idea why?

You can test it locally by running make test-sanity. You also can fix some issues my running make fix

camilamacedo86 avatar Aug 23 '22 16:08 camilamacedo86

Hi @everettraven, I did go mod tidy but it seems that DCO is still failing. Any idea why?

@assafad Looks to me like it passed. Must've just needed the test rerun which it should have done when someone authorized the tests to run.

everettraven avatar Aug 23 '22 19:08 everettraven

/approved

camilamacedo86 avatar Aug 24 '22 10:08 camilamacedo86

@assafad Thanks for the PR! This looks good and will be a great addition. I just have one question, what happens when the controller is restarted ? Do we keep incrementing the count or does it reset to 0 again? I'm not sure if keeping on incrementing the count would provide value from monitoring point of view on number of times the deployment size != replica size. But since this is an example intended more towards having an example on how to add custom metrics, it should still be fine, if we add a comment regarding that in the scaffolded code.

Thank you! The metric sets to 0 when the controller restarts.

assafad avatar Aug 24 '22 16:08 assafad