metric

package
v1.0.2-rc1 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2026 License: MIT Imports: 5 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	// EndpointFieldName — имя поля для эндпоинта (URL-путь).
	EndpointFieldName = "endpoint"

	// CodeFieldName — имя поля для HTTP-кода ответа.
	CodeFieldName = "code"
)

Variables

View Source
var (
	// RequestCountComponent — компонент для сбора метрики количества запросов.
	// Считает количество HTTP-запросов с разбивкой по эндпоинтам и кодам ответа.
	RequestCountComponent = &compogo.Component{
		Init: compogo.StepFunc(func(container compogo.Container) error {
			return container.Provide(NewRequestCount)
		}),
	}

	// DurationComponent — компонент для сбора метрики длительности запросов.
	// Измеряет время выполнения HTTP-запросов с разбивкой по эндпоинтам.
	DurationComponent = &compogo.Component{
		Init: compogo.StepFunc(func(container compogo.Container) error {
			return container.Provide(NewDuration)
		}),
	}
)

Functions

This section is empty.

Types

type Duration

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

Duration — middleware для сбора метрики длительности HTTP-запросов. Измеряет время выполнения каждого запроса в секундах.

Метрика: compogo_http_server_duration_seconds{app="myapp", endpoint="/api/v1/users"}

func NewDuration

func NewDuration(appConfig *compogo.Config) *Duration

func (*Duration) Middleware

func (middleware *Duration) Middleware(next http.Handler) http.Handler

type RequestCount

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

RequestCount — middleware для сбора метрики количества HTTP-запросов. Считает количество запросов с разбивкой по эндпоинтам и кодам ответа.

Метрика: compogo_http_server_requests_total{app="myapp", code="200", endpoint="/api/v1/users"}

func NewRequestCount

func NewRequestCount(appConfig *compogo.Config) *RequestCount

func (*RequestCount) Middleware

func (middleware *RequestCount) Middleware(next http.Handler) http.Handler

Jump to

Keyboard shortcuts

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