services

package
v4.0.0-rc14 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 16, 2021 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ByPercentage counter type
	ByPercentage = iota
	// Sequential counter type
	Sequential
)
View Source
const (
	// Critical severity
	Critical = iota
	// Degraded severity
	Degraded
	// Low severity
	Low
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	CounterType           int
	MaxErrorsAllowed      int
	MinSuccessExpected    int
	MaxLen                int
	PercentageToBeHealthy int
	Name                  string
	ServiceURL            string
	ServiceHealthEndpoint string
	Severity              int
	TaskPeriod            int
}

Config counter config

func NewServicesConfig

func NewServicesConfig(
	name string,
	url string,
	endpoint string,
) *Config

NewServicesConfig new config with default values

type CounterInterface

type CounterInterface interface {
	NotifyServiceHit(statusCode int, message string)
	IsHealthy() HealthyResult
	Start()
	Stop()
}

CounterInterface interface

type HealthDto

type HealthDto struct {
	Status string    `json:"serviceStatus"`
	Items  []ItemDto `json:"dependencies"`
}

HealthDto description

type HealthyResult

type HealthyResult struct {
	Name         string
	Severity     int
	Healthy      bool
	LastMessage  string
	HealthySince *time.Time
	LastHit      *time.Time
}

HealthyResult result

type ItemDto

type ItemDto struct {
	Service      string     `json:"service"`
	Healthy      bool       `json:"healthy"`
	Message      string     `json:"message,omitempty"`
	HealthySince *time.Time `json:"healthySince,omitempty"`
	LastHit      *time.Time `json:"lastHit,omitempty"`
}

ItemDto description

type MonitorInterface

type MonitorInterface interface {
	Start()
	Stop()
	GetHealthStatus() HealthDto
}

MonitorInterface services monitor interface

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL