go_http_utils

package module
v0.0.0-...-ba6f454 Latest Latest
Warning

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

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

README

Profiler URL

See https://pkg.go.dev/net/http/pprof

/debug/pprof/

Readiness

/_info

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatError

func FormatError(w http.ResponseWriter, status int, err error)

func Listen

func Listen(ctx context.Context, httpListener Listener, handler Mux) error

Listen runs http server with graceful shutdown.

func ServeHealthcheck

func ServeHealthcheck(ctx context.Context, log *zap.Logger)

ServeHealthcheck serves pprof and readiness endpoints.

func ServeRuntimeMetrics

func ServeRuntimeMetrics(ctx context.Context, m Metrics)

ServeRuntimeMetrics sends golang runtime metrics.

Types

type Listener

type Listener interface {
	Listen(context.Context, int, http.Handler) error
}

type Metrics

type Metrics interface {
	Gauge(string, interface{})
	Duration(string, time.Duration)
}

type Mux

type Mux interface {
	http.Handler
	Handle(string, http.Handler)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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