Skip to content

Commit

Permalink
updated readme
Browse files Browse the repository at this point in the history
  • Loading branch information
pcpratheesh committed Jul 24, 2023
1 parent 7a807c8 commit d96f7c0
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ go get github.com/pcpratheesh/go-healthwatch
```

## Usage
**Creating a Health Check**
### Creating a Health Check

To create a health check, you can use the `NewChecker`` function and provide the necessary options. You can specify the health checks to be performed and configure a service status notification webhook.
To create a health check, you can use the `NewChecker` function and provide the necessary options. You can specify the health checks to be performed and configure a service status notification webhook.

```go
healthchecker := gohealthwatch.NewChecker(
Expand All @@ -26,7 +26,7 @@ healthchecker := gohealthwatch.NewChecker(
)
```

**HealthCheckConfig**
### HealthCheckConfig

This is a configuration struct used to hold the settings for a health check. It contains the following fields:

Expand All @@ -39,9 +39,9 @@ Interval | The interval duration for the health check in seconds | False
HTTPHeader | An array of HTTP headers to include in the health check request | False
StatusCode | The expected HTTP status code for the health check response | True

**Overriding Checks and Run your own Checks**
### Run your own Checks for individual checklist

You can also override the checks to the health check configuration using the `AddCheck`` method. This allows you to override checks based on your specific requirements.
You can also override the checks to the health check configuration using the `AddCheck` method. This allows you to override checks based on your specific requirements.

The first argument in the checker.AddCheck() function should be the name of the health check. The second argument is a callback function that takes a `HealthCheckConfig` object as input and returns an `errors.Error` object.

Expand All @@ -52,15 +52,15 @@ checker.AddCheck("public-entries", func(check gohealthwatch.HealthCheckConfig) e
```


**Performing Health Checks**
### Performing Health Checks

To perform the health checks, simply call the `Check` method on the `HealthCheck` instance.
```
```go
checker.Check()
```


**Service Status Notification WebHook**
### Service Status Notification WebHook

The `WithServiceStatusWebHook` function is used to configure a service status notification webhook for the `HealthCheck` struct. It takes a callback function as an argument, which is invoked when a health check status changes.

Expand All @@ -78,7 +78,9 @@ gohealthwatch.WithServiceStatusWebHook(func(check gohealthwatch.HealthCheckConfi
This allows you to customize the behavior when a health check status changes. You can perform actions such as logging, sending notifications, or triggering other processes based on the status and error information.


See more samples at [Here](/example/)
## Example
See more samples at [here](/example/)

## Contributing
Contributions to GoHealthWatch are welcome! If you find any issues or have suggestions for improvements, please feel free to open an issue or submit a pull request on the GitHub repository.

Expand Down

0 comments on commit d96f7c0

Please sign in to comment.