metrics

package
v0.4.7 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrorsTotalName      = "errors_total"
	PanicsTotalName      = "panics_total"
	ErrorsByEndpointName = "errors_by_endpoint"
)

Metric names

Variables

View Source
var (
	// Operations metrics
	OperationsTotal       = "app_operations_total"
	OperationsErrorsTotal = "app_operations_errors_total"

	// Connection metrics
	ActiveConnections = "app_active_connections"

	// Health check metrics
	HealthCheckTotal    = "app_health_check_total"
	HealthCheckDuration = "app_health_check_duration_ms"

	// Server lifecycle metrics
	ServerStartTime = "app_server_start_time_seconds"
	ServerUptime    = "app_server_uptime_seconds"
)

Application-level metrics following Prometheus conventions

Functions

func RecordError

func RecordError(errorCode string, httpStatus int)

RecordError records an error with code and status

func RecordErrorByEndpoint

func RecordErrorByEndpoint(endpoint string, errorCode string)

RecordErrorByEndpoint records an error by endpoint

func RecordHealthCheck

func RecordHealthCheck(checkName string, healthy bool, duration time.Duration)

RecordHealthCheck records a health check execution

func RecordOperation

func RecordOperation(operation string, success bool)

RecordOperation records an application operation with status

func RecordOperationError

func RecordOperationError(operation string, errorType string)

RecordOperationError records an application operation error

func RecordPanic

func RecordPanic()

RecordPanic records a panic recovery

func SetActiveConnections

func SetActiveConnections(count int64)

SetActiveConnections sets the current number of active connections

func SetServerStartTime

func SetServerStartTime(timestamp int64)

SetServerStartTime records the server start time (Unix timestamp)

func SetServerUptime

func SetServerUptime(seconds int64)

SetServerUptime records the server uptime in seconds

Types

This section is empty.

Jump to

Keyboard shortcuts

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