package
0.24.0
Repository: https://github.com/lushdigital/core.git
Documentation: pkg.go.dev

# README

Ready Server

The package core/workers/readysrv is used to provide readiness checks for a service.

Configuration

The readiness server can be configured through the environment to match setup in the infrastructure.

  • READINESS_ADDR default: 0.0.0.0:3674
  • READINESS_PATH default: /ready

Examples

srv := readysrv.New(nil, readysrv.Checks{
    "google": readysrv.CheckerFunc(func() ([]string, bool) {
        if _, err := http.Get("https://google.com"); err != nil {
            return []string{err.Error()}, false
        }
        return []string{"google can be accessed"}, true
    }),
})
srv.Run(ctx)

# Functions

CheckHandler provides a function for providing health checks over http.
New creates a new default metrics server.

# Constants

DefaultAddr is the port that we listen to the prometheus path on by default.
DefaultPath is the path where we expose prometheus by default.

# Structs

Config represents the configuration for the metrics server.
Server defines a readiness server.

# Interfaces

Checker defines the interface for checking health of remote services.

# Type aliases

CheckerFunc defines a single function for checking health of remote services.
Checks defines a matrix of health checks to be run.