probe

package
v2.2.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2019 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package probe implements HTTP probes: the K8s readiness and liveliness probe handlers + Prometheus format.

Index

Constants

View Source
const (
	// DefaultHealthPath default Prometheus health metrics URL
	DefaultHealthPath = "/health"

	// Namespace namespace to use for Prometheus health metrics
	Namespace = ""
	// Subsystem subsystem to use for Prometheus health metrics
	Subsystem = ""
	// ServiceLabel label for service field
	ServiceLabel = "service"
	// DependencyLabel label for dependency field
	DependencyLabel = "dependency"
	// BuildVersionLabel label for build version field
	BuildVersionLabel = "build_version"
	// BuildDateLabel label for build date field
	BuildDateLabel = "build_date"

	// ServiceHealthName name of service health metric
	ServiceHealthName = "service_health"

	// ServiceHealthHelp help text for service health metric
	// Adapt Ligato status code for now.
	// TODO: Consolidate with that from the "Common Container Telemetry" proposal.
	// ServiceHealthHelp    string = "The health of the ServiceLabel 0 = INIT, 1 = UP, 2 = DOWN, 3 = OUTAGE"
	ServiceHealthHelp = "The health of the ServiceLabel 0 = INIT, 1 = OK, 2 = ERROR"

	// DependencyHealthName name of dependency health metric
	DependencyHealthName = "service_dependency_health"

	// DependencyHealthHelp help text for dependency health metric
	// Adapt Ligato status code for now.
	// TODO: Consolidate with that from the "Common Container Telemetry" proposal.
	// DependencyHealthHelp string = "The health of the DependencyLabel 0 = INIT, 1 = UP, 2 = DOWN, 3 = OUTAGE"
	DependencyHealthHelp = "The health of the DependencyLabel 0 = INIT, 1 = OK, 2 = ERROR"

	// ServiceInfoName name of service info metric
	ServiceInfoName = "service_info"
	// ServiceInfoHelp help text for service info metric
	ServiceInfoHelp = "Build info for the service.  Value is always 1, build info is in the tags."
)

Variables

View Source
var DefaultPlugin = *NewPlugin()

DefaultPlugin is a default instance of Plugin.

Functions

This section is empty.

Types

type Deps

type Deps struct {
	infra.PluginDeps
	ServiceLabel servicelabel.ReaderAPI
	StatusCheck  statuscheck.StatusReader // inject
	HTTP         rest.HTTPHandlers        // inject
	Prometheus   prom.API                 // inject
}

Deps lists dependencies of REST plugin.

type ExposedStatus added in v1.7.0

type ExposedStatus struct {
	status.AgentStatus
	PluginStatus map[string]*status.PluginStatus
	// NonFatalPlugins is a configured list of plugins whose
	// errors are not reflected in overall state.
	NonFatalPlugins []string
}

ExposedStatus groups the information exposed via readiness and liveness probe

type Option added in v1.5.0

type Option func(*Plugin)

Option is a function that can be used in NewPlugin to customize Plugin.

func UseDeps added in v1.5.0

func UseDeps(cb func(*Deps)) Option

UseDeps returns Option that can inject custom dependencies.

func WithNonFatalPlugins added in v1.7.0

func WithNonFatalPlugins(plugins []string) Option

WithNonFatalPlugins defines plugins whose errors are effectively ignored in agent's overall status.

type Plugin

type Plugin struct {
	Deps
	// NonFatalPlugins is a list of plugin names. Error reported by a plugin
	// from the list is not propagated into overall agent status.
	NonFatalPlugins []string
}

Plugin struct holds all plugin-related data.

func NewPlugin added in v1.5.0

func NewPlugin(opts ...Option) *Plugin

NewPlugin creates a new Plugin with the provided Options.

func (*Plugin) AfterInit

func (p *Plugin) AfterInit() error

AfterInit registers HTTP handlers for liveness and readiness probes.

func (*Plugin) Close

func (p *Plugin) Close() error

Close frees resources

func (*Plugin) Init

func (p *Plugin) Init() error

Init does nothing

Jump to

Keyboard shortcuts

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