selfmonitor

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2026 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Allowed

func Allowed(r *http.Request) bool

Allowed keeps the endpoint reachable only from a direct loopback caller. A request proxied by Caddy carries X-Forwarded-For and is refused, so mounting the route on a public-facing listener does not expose it.

func Handler

func Handler(service string, extra func() map[string]float64) http.HandlerFunc

Handler returns the GET /internal/monitor handler for a service. extra may be nil.

Types

type Snapshot

type Snapshot struct {
	Service       string             `json:"service"`
	HeapAlloc     uint64             `json:"heap_alloc"`
	HeapSys       uint64             `json:"heap_sys"`
	HeapObjects   uint64             `json:"heap_objects"`
	StackSys      uint64             `json:"stack_sys"`
	Goroutines    int                `json:"goroutines"`
	GCNum         uint32             `json:"gc_num"`
	GCPauseLastNs uint64             `json:"gc_pause_last_ns"`
	GCCPUFraction float64            `json:"gc_cpu_fraction"`
	NextGC        uint64             `json:"next_gc"`
	Extra         map[string]float64 `json:"extra,omitempty"`
}

func Self

func Self(service string, extra func() map[string]float64) Snapshot

Jump to

Keyboard shortcuts

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