metrics

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Gather added in v1.1.0

func Gather() []*dto.MetricFamily

func MustParseRequestID

func MustParseRequestID(h http.Header) string

func NewContext

func NewContext(ctx context.Context, metric *RequestMetric) context.Context

func RequestID

func RequestID() log.Valuer

Types

type CounterSmoother added in v1.1.0

type CounterSmoother struct {
	Alpha float64
	// contains filtered or unexported fields
}

func (*CounterSmoother) Update added in v1.1.0

func (s *CounterSmoother) Update(currentTotal float64) float64

type RequestMetric

type RequestMetric struct {
	StartAt           time.Time
	RequestID         string
	RecvReq           uint64
	SentResp          uint64
	StoreUrl          string
	CacheStatus       string
	RemoteAddr        string
	FirstResponseTime time.Time
}

func FromContext

func FromContext(ctx context.Context) *RequestMetric

func WithRequestMetric

func WithRequestMetric(req *http.Request) (*http.Request, *RequestMetric)

func (*RequestMetric) Clone

func (r *RequestMetric) Clone() *RequestMetric

type RequestsCodeTotal added in v1.1.0

type RequestsCodeTotal struct {
	Code  string  `json:"code"`
	Count float64 `json:"count"`
}

func CollectorRequestsCodeTotal added in v1.1.0

func CollectorRequestsCodeTotal() []*RequestsCodeTotal

Jump to

Keyboard shortcuts

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