SolarEdgeTech / pyctuator

Monitor Python applications using Spring Boot Admin
Apache License 2.0
175 stars 17 forks source link

Support for Apache Cassandra in DB Health #77

Open millerjp opened 2 years ago

millerjp commented 2 years ago

Hi - it would be helpful to a project I am on to support Apache Cassandra. If someone could give me an overview or some documentation on how this might be best implemented I would be happy to develop it.

Thanks.

michaelyaakoby commented 2 years ago

Hi, sorry for the late response. Will send you example later this week.

michaelyaakoby commented 2 years ago

@millerjp it would be great if you can send a PR with a "cassandra health indicator".

Before you begin, you need to decide:

  1. What's the criteria for the health-check to report that the DB is up
  2. What additional info do you want to include in the DB status

For example, Spring's CassandraHealthIndicator:

  1. Reports UP if the state of at least one node in the cql-session is UP
  2. Includes the version of the Cassandra in one of the nodes

In Pyctuator, health indicators extend HealthProvider and are registered with Pyctuator as demonstrated in advanced_example_app.py.

Two important notes:

  1. Pyctuator's dependencies are always optional, so anyone using it isn't forced to include modules they don't need.
  2. We require that every component in Pyctuator will be tested.
    1. Components that require external dependencies can be tested using gitlab's "services" as can be seen in python_package_build.yml
    2. Such tests should be skipped if the external resource isn't available which is done based on if the resource's module is installed or not, see test_redis_health_provider.py