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

Add Elasticsearch cluster health monitor DAGs #3748

Merged
merged 12 commits into from Feb 12, 2024

Conversation

sarayourfriend
Copy link
Contributor

@sarayourfriend sarayourfriend commented Feb 5, 2024

Fixes

Fixes #3747 by @sarayourfriend

Description

Adds two new dags to monitor the staging and production Elasticsearch clusters. Each dag runs on a 15 minute schedule.

Testing Instructions

Both DAGs should run and respond with the appropriate notification or alert based on the cluster health response.

Run these locally by searching for the monitoring tag and enabling the two elasticsearch_cluster_healthcheck. Both should pass. If production passes but staging does not, make sure you have a new copy of env.template at catalog/.env because staging ES connection string was only recently added.

Checklist

  • My pull request has a descriptive title (not a vague title likeUpdate index.md).
  • My pull request targets the default branch of the repository (main) or a parent feature branch.
  • My commit messages follow best practices.
  • My code follows the established code style of the repository.
  • I added or updated tests for the changes I made (if applicable).
  • I added or updated documentation (if applicable).
  • I tried running the project locally and verified that there are no visible errors.
  • I ran the DAG documentation generator (if applicable).

Developer Certificate of Origin

Developer Certificate of Origin
Developer Certificate of Origin
Version 1.1

Copyright (C) 2004, 2006 The Linux Foundation and its contributors.
1 Letterman Drive
Suite D4700
San Francisco, CA, 94129

Everyone is permitted to copy and distribute verbatim copies of this
license document, but changing it is not allowed.


Developer's Certificate of Origin 1.1

By making a contribution to this project, I certify that:

(a) The contribution was created in whole or in part by me and I
    have the right to submit it under the open source license
    indicated in the file; or

(b) The contribution is based upon previous work that, to the best
    of my knowledge, is covered under an appropriate open source
    license and I have the right under that license to submit that
    work with modifications, whether created in whole or in part
    by me, under the same open source license (unless I am
    permitted to submit under a different license), as indicated
    in the file; or

(c) The contribution was provided directly to me by some other
    person who certified (a), (b) or (c) and I have not modified
    it.

(d) I understand and agree that this project and the contribution
    are public and that a record of the contribution (including all
    personal information I submit with it, including my sign-off) is
    maintained indefinitely and may be redistributed consistent with
    this project or the open source license(s) involved.

@sarayourfriend sarayourfriend changed the title Add/elasticsearch monitor Add Elasticsearch cluster health monitor DAGs Feb 5, 2024
@openverse-bot openverse-bot added 🟧 priority: high Stalls work on the project or its dependents 🌟 goal: addition Addition of new feature 💻 aspect: code Concerns the software code in the repository 🚦 status: awaiting triage Has not been triaged & therefore, not ready for work labels Feb 5, 2024
@github-actions github-actions bot added 🧱 stack: catalog Related to the catalog and Airflow DAGs 🧱 stack: documentation Related to Sphinx documentation labels Feb 5, 2024
Copy link

github-actions bot commented Feb 5, 2024

Full-stack documentation: https://docs.openverse.org/_preview/3748

Please note that GitHub pages takes a little time to deploy newly pushed code, if the links above don't work or you see old versions, wait 5 minutes and try again.

You can check the GitHub pages deployment action list to see the current status of the deployments.

Changed files 🔄:

@obulat obulat removed the 🚦 status: awaiting triage Has not been triaged & therefore, not ready for work label Feb 5, 2024
from airflow.models.connection import Connection
from airflow.models.xcom_arg import XComArg

from common.constants import Environment
Copy link
Contributor

Choose a reason for hiding this comment

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

FYI I am working on a PR where I move this task into a new file called common/elasticsearch.py instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Gotcha! Should I update this PR to do that as well or do you have a different approach you would prefer?

Copy link
Contributor

Choose a reason for hiding this comment

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

It looks like mine will take a minute to get over the line -- I'm totally fine to keep it here for this PR and I can rebase/update in mine.

@sarayourfriend
Copy link
Contributor Author

I am struggling to get the DAG docs generation to run locally, due to an issue with the version of just I was on (I think). Hopefully able to push the updated version soon.

@sarayourfriend sarayourfriend marked this pull request as ready for review February 6, 2024 02:14
@sarayourfriend sarayourfriend requested review from a team as code owners February 6, 2024 02:14
@fcoveram fcoveram removed their request for review February 6, 2024 07:49
Copy link
Contributor

@AetherUnbound AetherUnbound left a comment

Choose a reason for hiding this comment

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

This is great, I'm glad it was easy enough to knock out! My only blocking request is that we hold off on yellow alerts during a data refresh, see the explanation given in the in-line comment. Tested locally and it works as expected too 😄

catalog/dags/elasticsearch_cluster/healthcheck_dag.py Outdated Show resolved Hide resolved
catalog/dags/elasticsearch_cluster/healthcheck_dag.py Outdated Show resolved Hide resolved
catalog/dags/elasticsearch_cluster/healthcheck_dag.py Outdated Show resolved Hide resolved
@sarayourfriend
Copy link
Contributor Author

@AetherUnbound I've made the requested changes. I made it so that the notification of yellow status is skipped if the data refresh is running and environment is production, but otherwise the other two notification types still send. I haven't done anything to address the same issue in staging, though, even though there are a few staging DAGs that would cause a yellow status. I don't know how to create a comprehensive list of them without manually doing it, which would easily lead to drift. Do you have any advice? It will be easy to add later as well. I don't think we currently use those DAGs very much if at all.

@AetherUnbound
Copy link
Contributor

I think catching the case where the data refresh in production is perfect for now! If we find it alerts too much in other scenarios, we can figure out how to add those as well. Thanks!

Copy link
Contributor

@AetherUnbound AetherUnbound left a comment

Choose a reason for hiding this comment

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

Thanks for making those changes, looks great!

@openverse-bot
Copy link
Collaborator

Based on the high urgency of this PR, the following reviewers are being gently reminded to review this PR:

@krysal
@stacimc
This reminder is being automatically generated due to the urgency configuration.

Excluding weekend1 days, this PR was ready for review 2 day(s) ago. PRs labelled with high urgency are expected to be reviewed within 2 weekday(s)2.

@sarayourfriend, if this PR is not ready for a review, please draft it to prevent reviewers from getting further unnecessary pings.

Footnotes

  1. Specifically, Saturday and Sunday.

  2. For the purpose of these reminders we treat Monday - Friday as weekdays. Please note that the operation that generates these reminders runs at midnight UTC on Monday - Friday. This means that depending on your timezone, you may be pinged outside of the expected range.

Copy link
Contributor

@stacimc stacimc left a comment

Choose a reason for hiding this comment

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

Looks great -- the checks for running data refreshes are fantastic, and I agree that it's fine to consider the staging alerts in the future. 🚢

from airflow.models.connection import Connection
from airflow.models.xcom_arg import XComArg

from common.constants import Environment
Copy link
Contributor

Choose a reason for hiding this comment

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

It looks like mine will take a minute to get over the line -- I'm totally fine to keep it here for this PR and I can rebase/update in mine.

@sarayourfriend sarayourfriend merged commit 30abcc4 into main Feb 12, 2024
46 checks passed
@sarayourfriend sarayourfriend deleted the add/elasticsearch-monitor branch February 12, 2024 22:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💻 aspect: code Concerns the software code in the repository 🌟 goal: addition Addition of new feature 🟧 priority: high Stalls work on the project or its dependents 🧱 stack: catalog Related to the catalog and Airflow DAGs 🧱 stack: documentation Related to Sphinx documentation
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Airflow DAG to monitor Elasticsearch cluster health
5 participants