probe

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2017 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package probe implements Liveness/Readiness/Prometheus health/metrics HTTP handlers.

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

Index

Constants

View Source
const (

	// DefaultMetricsPath default Prometheus metrics URL
	DefaultMetricsPath string = "/metrics"
	// DefaultHealthPath default Prometheus health metrics URL
	DefaultHealthPath string = "/health"

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

	// ServiceHealthName name of service health metric
	ServiceHealthName string = "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 string = "The health of the ServiceLabel 0 = INIT, 1 = OK, 2 = ERROR"

	// DependencyHealthName name of dependency health metric
	DependencyHealthName string = "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 string = "The health of the DependencyLabel 0 = INIT, 1 = OK, 2 = ERROR"

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

Variables

This section is empty.

Functions

This section is empty.

Types

type Deps

type Deps struct {
	local.PluginInfraDeps                          // inject
	HTTP                  rest.HTTPHandlers        // inject
	StatusCheck           statuscheck.StatusReader // inject
}

Deps lists dependencies of all proble plugins.

type Plugin

type Plugin struct {
	Deps
}

Plugin struct holds all plugin-related data.

func (*Plugin) AfterInit

func (p *Plugin) AfterInit() error

AfterInit registers HTTP handlers for liveness and readiness probes.

func (*Plugin) Init

func (p *Plugin) Init() (err error)

Init does nothing

func (*Plugin) String

func (p *Plugin) String() string

String returns plugin name if it was injected, "HEALTH_RPC_PROBES" otherwise.

type PrometheusPlugin added in v1.0.4

type PrometheusPlugin struct {
	Deps
	// contains filtered or unexported fields
}

PrometheusPlugin struct holds all plugin-related data.

func (*PrometheusPlugin) AfterInit added in v1.0.4

func (p *PrometheusPlugin) AfterInit() error

AfterInit registers HTTP handlers.

func (*PrometheusPlugin) Close added in v1.0.4

func (p *PrometheusPlugin) Close() error

Close shutdowns HTTP if a custom instance was created in Init().

func (*PrometheusPlugin) Init added in v1.0.4

func (p *PrometheusPlugin) Init() (err error)

Init may create a new (custom) instance of HTTP if the injected instance uses different HTTP port than requested.

func (*PrometheusPlugin) String added in v1.0.4

func (p *PrometheusPlugin) String() string

String returns plugin name if it was injected, defaultPluginName otherwise.

Jump to

Keyboard shortcuts

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