server

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2025 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func StartMonitoringServer

func StartMonitoringServer(
	ctx context.Context,
	log *slog.Logger,
	reg *prometheus.Registry,
	dtb *pgxpool.Pool,
	port int,
	parseHost string,
)

StartMonitoringServer starts an HTTP server that provides health check and metrics endpoints. It listens on the specified port and logs the server's status and any errors encountered.

Parameters: - ctx: A context.Context for managing cancellation and timeouts. - log: A logger for logging server events and errors. - reg: A registry with Prometheus collectors. - dtb: A pgxpool connector for database methods (ping) - port: The port number on which the server will listen.

Types

type DBPinger

type DBPinger interface {
	Ping(ctx context.Context) error
}

type HealthChecker

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

func NewHealthChecker

func NewHealthChecker(db DBPinger, parseHost string, log *slog.Logger) *HealthChecker

func (*HealthChecker) ServeHTTP

func (h *HealthChecker) ServeHTTP(writer http.ResponseWriter, req *http.Request)

Jump to

Keyboard shortcuts

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