uPortal-Project / uPortal

Enterprise open source portal built by and for the higher education community.
https://www.apereo.org/projects/uportal
Apache License 2.0
272 stars 273 forks source link

Enhance /uPortal/health-check #2380

Open bjagg opened 3 years ago

bjagg commented 3 years ago

The /uPortal/health-check only provides a basic response that does not exercise much of the system.

If would be more useful if the check would also perform a database call to confirm that key service is working. This can be triggered by an optional URL parameter.

Other information may also be included, such as Java version, etc. N.B. do not supply too much information that may be beneficial to hackers.

jgribonvald commented 3 years ago

I would recommend to use a metric system like dropwizard: https://metrics.dropwizard.io/4.1.2/manual/healthchecks.html for before spring boot 2.0 app. And actuator with micrometer for spring boot 2.0 and upper.

With dropwizard, that I already used we define a HealthCheckRegistry on which you add already available module that will watch on your database, LDAP, cache, JVM, etc... also this can provide metrics and it can provide metrics to your metric tool ;)

Maybe this example is a good start: https://reflectoring.io/spring-boot-health-check/

bjagg commented 3 years ago

@jgribonvald those are great suggestions; however, I completed a simple health check for now.

Once the Metrics v5 is out, we should consider integrated it as a metrics dashboard!

allanjackson commented 3 years ago

So to use the new healthcheck with database verification, we would switch the url to /uPortal/health-check?detail=DB ? And then if the database is down it'll return a 500 error?

bjagg commented 3 years ago

@allanjackson I believe so. Have you been able to check it?