Skip to content

Add metrics and alerts tutorial to the docs#6341

Merged
varshaprasad96 merged 1 commit into
operator-framework:masterfrom
assafad:monitoring-docs
Mar 27, 2023
Merged

Add metrics and alerts tutorial to the docs#6341
varshaprasad96 merged 1 commit into
operator-framework:masterfrom
assafad:monitoring-docs

Conversation

@assafad

@assafad assafad commented Feb 28, 2023

Copy link
Copy Markdown
Contributor

Description of the change:
Add a monitoring tutorial to the advanced-topics page. This tutorial explains how to expose the first operator's custom metrics and alerts, by demonstrating over the monitoring sample - memcached-operator.

Checklist

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

@assafad

assafad commented Feb 28, 2023

Copy link
Copy Markdown
Contributor Author

/cc @sradco

@openshift-ci

openshift-ci Bot commented Feb 28, 2023

Copy link
Copy Markdown

@assafad: GitHub didn't allow me to request PR reviews from the following users: sradco.

Note that only operator-framework members and repo collaborators can review this PR, and authors cannot review their own PRs.

Details

In response to this:

/cc @sradco

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.

@assafad assafad force-pushed the monitoring-docs branch 3 times, most recently from baeaa34 to d92454e Compare February 28, 2023 10:21
Comment thread website/content/en/docs/building-operators/golang/advanced-topics.md Outdated
Comment thread website/content/en/docs/building-operators/golang/advanced-topics.md Outdated
Comment thread website/content/en/docs/building-operators/golang/advanced-topics.md Outdated
@assafad assafad force-pushed the monitoring-docs branch 2 times, most recently from 39fdf24 to c657fac Compare February 28, 2023 13:53
Comment thread website/content/en/docs/building-operators/golang/advanced-topics.md Outdated
Comment thread website/content/en/docs/building-operators/golang/advanced-topics.md Outdated
- Create a new `monitoring` directory, which will contain the metrics and alerts implementation. It is recommended to create a dedicated `monitoring` directory, in order to keep the monitoring implementation separated from the core operator's logic. This will allow easier maintenance of both the core operator code and the monitoring code.
- Add the following command to the `dockerfile`:
```dockerfile
COPY monitoring/ monitoring/

@sradco sradco Feb 28, 2023

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think this pre-requisite and the one before should be in a separate header like:

#### Add Monitoring to Your Operator  

For a quick start, Copy the example `/monitoring` sub folder from the Memcached operator[add link to the example operator] and update it to you needs.  
This sub folder will include all the monitoring related code and logic.
**Note:** We created a dedicated `/monitoring` directory, since it is recommended to keep the monitoring code and the core operator code separated.

@assafad assafad force-pushed the monitoring-docs branch 7 times, most recently from 6cff809 to 099d163 Compare March 6, 2023 15:36
Comment thread website/content/en/docs/building-operators/golang/advanced-topics.md Outdated
Comment thread website/content/en/docs/building-operators/golang/advanced-topics.md Outdated
@assafad assafad force-pushed the monitoring-docs branch 2 times, most recently from 2ee9199 to 64920d9 Compare March 7, 2023 08:48
@assafad

assafad commented Mar 7, 2023

Copy link
Copy Markdown
Contributor Author

/hold

@openshift-ci openshift-ci Bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Mar 7, 2023

@everettraven everettraven left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Just a few nits, other than that looks good to me! Thanks @assafad for working on this!

Comment thread website/content/en/docs/building-operators/golang/advanced-topics.md Outdated
Comment thread website/content/en/docs/building-operators/golang/advanced-topics.md Outdated
Comment thread website/content/en/docs/building-operators/golang/advanced-topics.md Outdated
Comment thread website/content/en/docs/building-operators/golang/advanced-topics.md Outdated
@assafad assafad force-pushed the monitoring-docs branch 3 times, most recently from d15160e to 29981a6 Compare March 8, 2023 17:57
@assafad

assafad commented Mar 15, 2023

Copy link
Copy Markdown
Contributor Author

/unhold

@openshift-ci openshift-ci Bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Mar 15, 2023


where we assume that the prometheus service is available in the `monitoring` namespace.
Now you can access Prometheus UI using [http://localhost:9090](http://localhost:9090).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@everettraven, @varshaprasad96 I think sanity fails because this URL is not accessible. How can we handle that?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@varshaprasad96 varshaprasad96 Mar 24, 2023

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

As a temporary workaround, we need not add it as a link:

Suggested change
Now you can access Prometheus UI using [http://localhost:9090](http://localhost:9090).
Now you can access Prometheus UI. It is usually available at `http://localhost:9090`. For more details on exposing prometheus metrics, please [refer](https://prometheus.io/docs/prometheus/latest/getting_started/#starting-prometheus).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done

@assafad

assafad commented Mar 15, 2023

Copy link
Copy Markdown
Contributor Author

Hi @sradco, @everettraven, @varshaprasad96, anything else we're missing in order to merge this one?

@sradco

sradco commented Mar 20, 2023

Copy link
Copy Markdown
Contributor

/lgtm

@openshift-ci

openshift-ci Bot commented Mar 20, 2023

Copy link
Copy Markdown

@sradco: changing LGTM is restricted to collaborators

Details

In response to this:

/lgtm

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.

@varshaprasad96 varshaprasad96 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The changes look good. @assafad thanks for the PR!. Could you please address this one comment, so that we can make the sanity pass before merging it.

@assafad assafad force-pushed the monitoring-docs branch 3 times, most recently from 0889ac0 to 2711ee4 Compare March 24, 2023 20:19
Signed-off-by: assaf-admi <aadmi@redhat.com>
@varshaprasad96 varshaprasad96 merged commit 3af4acb into operator-framework:master Mar 27, 2023
oceanc80 pushed a commit to oceanc80/operator-sdk that referenced this pull request Apr 28, 2023
Signed-off-by: assaf-admi <aadmi@redhat.com>
Signed-off-by: Catherine Chan-Tse <cchantse@redhat.com>
oceanc80 added a commit that referenced this pull request Apr 28, 2023
Signed-off-by: assaf-admi <aadmi@redhat.com>
Signed-off-by: Catherine Chan-Tse <cchantse@redhat.com>
Co-authored-by: Assaf Admi <90143867+assafad@users.noreply.github.com>
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