<commit_before># Healthchecker

## Installation

Add this line to your application's Gemfile:

```ruby
gem 'healthchecker'
```

And then execute:

    $ bundle

Or install it yourself as:

    $ gem install healthchecker

## Usage

In your `config/routes.rb`, mount the engine:
```ruby
Rails.application.routes.draw do
  # ...
  mount Healthchecker::Engine => '/healthchecker'

  # Any wild card end-points
end
```

In an initializer such as `config/initializers/healthchecker.rb`, add your checks.
Example:
```ruby
class CustomHealthcheck < Healthchecker::Check
  def check!
    options[:pass_value] == 'FOO'
  end
end

Healthchecker.add_check(:redis, client: Resque.redis, description: 'Resque.redis')
Healthchecker.add_check(:redis, client: Redis.current, description: 'Some description that will show up in error messages')
Healthchecker.add_check(:database)
Healthchecker.add_check(:migration)
Healthchecker.add_check(:cache)<commit_msg>Add documentation on end-points this will add<commit_after># Healthchecker

## Installation

Add this line to your application's Gemfile:

```ruby
gem 'healthchecker'
```

And then execute:

    $ bundle

Or install it yourself as:

    $ gem install healthchecker

## Usage

In your `config/routes.rb`, mount the engine:
```ruby
Rails.application.routes.draw do
  # ...
  mount Healthchecker::Engine => '/healthchecker'

  # Any wild card end-points
end
```

With that you will be able to hit:

curl <service_uri>/healthchecker/status
which will return 200 with {"status": "ok"}
or return 500 with {"status": <error messages>}

In an initializer such as `config/initializers/healthchecker.rb`, add your checks.
Example:
```ruby
class CustomHealthcheck < Healthchecker::Check
  def check!
    options[:pass_value] == 'FOO'
  end
end

Healthchecker.add_check(:redis, client: Resque.redis, description: 'Resque.redis')
Healthchecker.add_check(:redis, client: Redis.current, description: 'Some description that will show up in error messages')
Healthchecker.add_check(:database)
Healthchecker.add_check(:migration)
Healthchecker.add_check(:cache)
{'fraction_non_alphanumeric': 0.11223021582733812, 'fraction_numerical': 0.0028776978417266188, 'mean_word_length': 5.171597633136095, 'pattern_counts': {'":': 2, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '696595', 'n_tokens_mistral': 673, 'n_tokens_neox': 642, 'n_words': 197}