Documentation ¶
Index ¶
- Constants
- Variables
- func Counter(name string, description string, tags ...tag.Key) *stats.Int64Measure
- func Gauge(name string, description string, tags ...tag.Key) *stats.Int64Measure
- func HistogramWithBounds(name string, description string, unit string, bounds []float64, ...) *stats.Int64Measure
- func NewAlwaysReadyHealthCheck() http.Handler
- func NewHealthCheck(probes []func(context.Context) error) http.Handler
- func RecordNUnitMeasurement(ctx context.Context, s *stats.Int64Measure, n int64, tags ...tag.Mutator)
- func RecordUnitMeasurement(ctx context.Context, s *stats.Int64Measure, tags ...tag.Mutator)
- func SetGauge(ctx context.Context, s *stats.Int64Measure, n int64, tags ...tag.Mutator)
- func Setup(p Params, b Bindings) error
- type Bindings
- type Params
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 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 ¶
NewAlwaysReadyHealthCheck indicates that the service is always healthy. Used for static HTTP servers.
func NewHealthCheck ¶
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
RecordUnitMeasurement records a data point using the input metric by one unit with given tags.
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.
Click to show internal directories.
Click to hide internal directories.