telemetry

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2021 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ConfigNameEnableMetrics indicates that telemetry is enabled.
	ConfigNameEnableMetrics = "telemetry.prometheus.enable"
)
View Source
const (
	// HealthCheckEndpoint is the endpoint for Kubernetes health probes.
	// See: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/
	HealthCheckEndpoint = "/healthz"
)

Variables

View Source
var (
	DefaultBytesDistribution        = view.Distribution(64, 128, 256, 512, 1024, 2048, 4096, 16384, 65536, 262144, 1048576)
	DefaultMillisecondsDistribution = view.Distribution(0.01, 0.05, 0.1, 0.3, 0.6, 0.8, 1, 2, 3, 4, 5, 6, 8, 10, 13, 16, 20, 25, 30, 40, 50, 65, 80, 100, 130, 160, 200, 250, 300, 400, 500, 650, 800, 1000, 2000, 5000, 10000, 20000, 50000, 100000)
	DefaultCountDistribution        = view.Distribution(1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536)
)

Default histogram distributions

Functions

func Counter

func Counter(name string, description string, tags ...tag.Key) *stats.Int64Measure

Counter creates a counter metric to be recorded with dimensionless unit.

func Gauge added in v0.7.0

func Gauge(name string, description string, tags ...tag.Key) *stats.Int64Measure

Gauge creates a gauge metric to be recorded with dimensionless unit.

func HistogramWithBounds added in v0.8.0

func HistogramWithBounds(name string, description string, unit string, bounds []float64, tags ...tag.Key) *stats.Int64Measure

HistogramWithBounds creates a prometheus histogram metric to be recorded with specified bounds and metric type.

func NewAlwaysReadyHealthCheck

func NewAlwaysReadyHealthCheck() http.Handler

NewAlwaysReadyHealthCheck indicates that the service is always healthy. Used for static HTTP servers.

func NewHealthCheck

func NewHealthCheck(probes []func(context.Context) error) http.Handler

NewHealthCheck creates an HTTP handler for Kubernetes liveness and readiness checks.

func RecordNUnitMeasurement added in v0.8.0

func RecordNUnitMeasurement(ctx context.Context, s *stats.Int64Measure, n int64, tags ...tag.Mutator)

RecordNUnitMeasurement records a data point using the input metric by N units with given tags.

func RecordUnitMeasurement added in v0.8.0

func RecordUnitMeasurement(ctx context.Context, s *stats.Int64Measure, tags ...tag.Mutator)

RecordUnitMeasurement records a data point using the input metric by one unit with given tags.

func SetGauge added in v0.7.0

func SetGauge(ctx context.Context, s *stats.Int64Measure, n int64, tags ...tag.Mutator)

SetGauge sets the value of the metric

func Setup

func Setup(p Params, b Bindings) error

Setup configures the telemetry for the server.

Types

type Bindings added in v1.0.0

type Bindings interface {
	TelemetryHandle(pattern string, handler http.Handler)
	TelemetryHandleFunc(pattern string, handler func(http.ResponseWriter, *http.Request))
	AddCloser(c func())
	AddCloserErr(c func() error)
}

Bindings allows appmain to bind telemetry without a circular dependency.

type Params added in v1.0.0

type Params interface {
	Config() config.View
	ServiceName() string
}

Params allows appmain to bind telemetry without a circular dependency.

Jump to

Keyboard shortcuts

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