provider

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2024 License: BSD-3-Clause Imports: 6 Imported by: 0

README

Platform Health Providers

Platform Health Providers are extensions to the platform-health server. They enable the server to report on the health and status of a variety of external systems. This extensibility allows the platform-health server to be a versatile tool for monitoring and maintaining the health of your entire platform.

Interface

To create a new provider, there are a few requirements:

  • Implement the provider.Service interface: The provider.Service interface defines the methods that a provider must implement. This includes methods for checking the health and status of the external system that the provider is designed to interact with.

  • Register with the internal registry: Providers must register themselves with the platform-health server's internal registry. This is done with a call to provider.Register in an init() function. The init() function is automatically called when the program starts, registering the provider before the server begins handling requests.

  • Include via blank import: To include the provider in the server, it must be imported using a blank import statement (i.e., _ path/to/module) in the server command.

By following these guidelines, you can extend the platform-health server to interact with any external system, making it a powerful tool for platform health monitoring.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Providers = ProviderRegistry{}

Providers is a map of provider names to their types, used for registering providers.

Functions

func Check

func Check(ctx context.Context, instances []Instance) (response []*ph.HealthCheckResponse, status ph.Status)

func GetHealthWithDuration

func GetHealthWithDuration(ctx context.Context, instance Instance) *ph.HealthCheckResponse

func ProviderList

func ProviderList() []string

List returns a list of registered providers.

func Register

func Register(name string, provider Instance)

Register adds a provider to the registry.

Types

type Config

type Config interface {
	GetInstances() []Instance
}

Config is the interface through which the provider configuration is retrieved.

type Instance

type Instance interface {
	// GetType returns the provider type of the instance
	GetType() string
	// GetName returns the name of the instance
	GetName() string
	// GetHealth checks and returns the instance
	GetHealth(context.Context) *ph.HealthCheckResponse
	// SetDefaults sets the default values for the instance
	SetDefaults()
}

Instance is the interface that must be implemented by all providers.

type ProviderRegistry

type ProviderRegistry map[string]reflect.Type

Directories

Path Synopsis
Code generated by go generate; DO NOT EDIT.
Code generated by go generate; DO NOT EDIT.

Jump to

Keyboard shortcuts

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