metricsutil

package
v1.3.106 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2026 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Overview

Package metricsutil pkg/metricsutil/requests_in_flight_count_middleware.go c0-com-util

Package metricsutil pkg/metricsutil/status_response_writer.go c0-com-util

Package metricsutil pkg/metricsutil/victoria_metrics_int_gauge_wrapper.go c0-com-util

Package metricsutil pkg/metricsutil/victoria_metrics_uint_gauge_wrapper.go c0-com-util

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddMetricsHandler

func AddMetricsHandler(mux *httputil.Router)

AddMetricsHandler adds a prometheus-format Handle at '/metrics' to the provided serve mux.

func RequestDurationMiddleware

func RequestDurationMiddleware(next http.Handler) http.Handler

RequestDurationMiddleware is a request duration tracking middleware.

func ServeHTTPMetrics

func ServeHTTPMetrics(log logrus.FieldLogger, addr string)

ServeHTTPMetrics starts serving metrics on a given `addr`.

func ServePProf

func ServePProf(log logrus.FieldLogger, addr, serviceName string)

ServePProf starts a pprof debug server on the given address. The serviceName is exposed at /debug/service so operators can identify which service a pprof endpoint belongs to.

Types

type RequestsInFlightCountMiddleware

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

RequestsInFlightCountMiddleware is a middleware to track current requests-in-flight count.

func NewRequestsInFlightCountMiddleware

func NewRequestsInFlightCountMiddleware() *RequestsInFlightCountMiddleware

NewRequestsInFlightCountMiddleware constructs `RequestsInFlightCountMiddleware`.

func (*RequestsInFlightCountMiddleware) Handle

Handle adds to the requests count during request serving.

type StatusResponseWriter

type StatusResponseWriter struct {
	http.ResponseWriter
	// contains filtered or unexported fields
}

StatusResponseWriter wraps `http.ResponseWriter` but stores status code on call to `WriteHeader`.

func NewStatusResponseWriter

func NewStatusResponseWriter(w http.ResponseWriter) *StatusResponseWriter

NewStatusResponseWriter wraps `http.ResponseWriter` constructing `StatusResponseWriter`.

func (*StatusResponseWriter) StatusCode

func (w *StatusResponseWriter) StatusCode() int

StatusCode gets status code from the writer.

func (*StatusResponseWriter) WriteHeader

func (w *StatusResponseWriter) WriteHeader(statusCode int)

WriteHeader implements `http.ResponseWriter` storing the written status code.

type VictoriaMetricsIntGaugeWrapper

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

VictoriaMetricsIntGaugeWrapper wraps Victoria Metrics int gauge encapsulating all the needed logic to control the value.

func NewVictoriaMetricsIntGauge

func NewVictoriaMetricsIntGauge(name string) *VictoriaMetricsIntGaugeWrapper

NewVictoriaMetricsIntGauge constructs new wrapper for Victoria Metric int gauge with the name `name`.

func (*VictoriaMetricsIntGaugeWrapper) Dec

Dec decrements gauge value.

func (*VictoriaMetricsIntGaugeWrapper) Inc

Inc increments gauge value.

func (*VictoriaMetricsIntGaugeWrapper) Set

Set sets gauge value.

func (*VictoriaMetricsIntGaugeWrapper) Val

Val gets gauge value.

type VictoriaMetricsUintGaugeWrapper

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

VictoriaMetricsUintGaugeWrapper wraps Victoria Metrics int gauge encapsulating all the needed logic to control the value.

func NewVictoriaMetricsUintGauge

func NewVictoriaMetricsUintGauge(name string) *VictoriaMetricsUintGaugeWrapper

NewVictoriaMetricsUintGauge constructs new wrapper for Victoria Metric int gauge with the name `name`.

func (*VictoriaMetricsUintGaugeWrapper) Dec

Dec decrements gauge value.

func (*VictoriaMetricsUintGaugeWrapper) Inc

Inc increments gauge value.

func (*VictoriaMetricsUintGaugeWrapper) Set

Set sets gauge value.

func (*VictoriaMetricsUintGaugeWrapper) Val

Val gets gauge value.

Jump to

Keyboard shortcuts

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