operator-sdk
operator-sdk copied to clipboard
Add a metric to the sample memcached-operator
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:
- [ ] Add a new changelog fragment in
changelog/fragments
(seechangelog/fragments/00-template.yaml
) - [ ] Add or update relevant sections of the docs website in
website/content/en/docs
Signed-off-by: assafad [email protected]
/hold
/unhold
/hold cancel
It shows nice to get reviews now.
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.
/hold
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
/unhold
/retest
@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.
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?
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
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.
/approved
@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.