Health Check properties

Oct 3, 2014 at 9:51 PM
Am I missing something, or is it impossible for a HealthCheck to access the RequiredProperties that it was configured with?

I'm looking to add properties in the health check configuration, and I want to pass these in the notification generated by the health check.

Is this possible, or is there a better alternative?
Coordinator
Oct 4, 2014 at 12:48 PM
Hi - the required properties really just allow the configuration UI/component to validate the config being saved. You will need to have properties on your config class to store the values that you need and set the values in the UI - when wolfpack boots an instance of your config class is rehydrated from the json config file and injected into the associated health check so you will have access to those required config properties inside the check.

The best mechanism to forward those config values into the notification is to use the notification "properties" collection - this just a name/value bag. There is also a Tags property on the notification - you could tag the notification with the values that way. Either way the values are persisted in the database (SQL, mongo etc) so you can find them later.

HTH!

James
Oct 4, 2014 at 1:23 PM
Thanks James,

I originally tried adding addition properties to the ISupportNotification, but the json for Data became very messy. If the config were created from the UI, it failed to load in the code, and if hand edited to load in code, the UI javascript failed to deserialize. And, every healthcheck needed minor mods.

Instead, I had good luck adding new properties into the .config files in the RequireProperties section, so that all existing health checks can leverage this without changes to their code or classes. Late last night, I worked out how to find them via ConfigurationManager, and so then HealthCheckBase can obtain them and add them to the notification request.

I will likely keep this approach, and show you what I have when it's cleaned up a somewhat. Update you Monday or Tuesday!