metrics

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// EnvChiPrometheusLatencyBuckets represents an environment variable, which is formatted like "100,200,300,400" as string
	EnvChiPrometheusLatencyBuckets = "CHI_PROMETHEUS_LATENCY_BUCKETS"
	RequestsCollectorName          = "chi_requests_total"
	LatencyCollectorName           = "chi_request_duration_milliseconds"
)
View Source
const (

	// Agent metrics
	AgentStatusCount = "agent_status_count"
)

Variables

View Source
var UniqueVisitsPerWeek = &uniqueVisits{
	counter:       totalUniqueVisitPerWeekMetric,
	visitorsCache: make(map[string]struct{}),
}

Functions

func IncreaseOvaDownloadsTotalMetric

func IncreaseOvaDownloadsTotalMetric(state string)

func NewPrometheusMetricsHandler

func NewPrometheusMetricsHandler() *prometheusMetricsHandler

NewPrometheusMetricsHandler adds custom metrics and proxy to prometheus handler

func RegisterMetrics

func RegisterMetrics(s store.Store)

func UpdateAgentStateCounterMetric

func UpdateAgentStateCounterMetric(state string, count int)

Types

type Middleware

type Middleware struct {
	// contains filtered or unexported fields
}

Middleware is a handler that exposes prometheus metrics for the number of requests, the latency, and the response size partitioned by status code, method, and HTTP path.

func NewMiddleware

func NewMiddleware(name string) *Middleware

New returns a new prometheus middleware for the provided service name.

func (Middleware) Collectors

func (m Middleware) Collectors() []prometheus.Collector

Collectors returns collector for your own collector registry.

func (Middleware) Handler

func (m Middleware) Handler(next http.Handler) http.Handler

Handler returns a handler for the middleware pattern.

func (Middleware) MustRegisterDefault

func (m Middleware) MustRegisterDefault()

MustRegisterDefault registers collectors to DefaultRegisterer. If you don't initialize the collector registry, this method should be called before calling promhttp.Handler().

Jump to

Keyboard shortcuts

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