Documentation
¶
Index ¶
- func DurationMillis(duration time.Duration) int64
- func Enabled(debugEnabled bool, httpAddr string) bool
- func IsLoopbackBind(addr string) bool
- func RegisterDebugHandlers(mux *http.ServeMux, options DebugOptions)
- func RegisterRoutes(mux *http.ServeMux, svc *Service)
- type DebugOptions
- type IngestionSnapshotter
- type RuntimeOptions
- type RuntimeSnapshot
- type Service
- type Snapshot
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DurationMillis ¶
func IsLoopbackBind ¶
func RegisterDebugHandlers ¶ added in v0.3.0
func RegisterDebugHandlers(mux *http.ServeMux, options DebugOptions)
RegisterDebugHandlers mounts the opt-in debug handlers (pprof, expvar) on the provided mux. It is the runtime counterpart to the [debug].pprof_enabled and expvar_enabled config flags: those flags are parsed by the config layer but, without this wiring, never actually exposed. The caller MUST gate this on diagnostics.Enabled (debug.enabled AND a loopback bind) so the handlers are unreachable from a non-loopback address even if the flags are on. The pprof handlers are registered explicitly on the supplied mux rather than via the net/http/pprof init side effects on http.DefaultServeMux, so they never leak to any other server that shares the default mux.
Routes mounted (pprofEnabled):
GET /debug/pprof/ index (list of profiles)
GET /debug/pprof/cmdline
GET /debug/pprof/profile CPU profile (default 30s; seconds GET param)
GET /debug/pprof/symbol
GET /debug/pprof/trace execution trace
GET /debug/pprof/{heap,goroutine,block,mutex,allocs,threadcreate}
Routes mounted (expvarEnabled):
GET /debug/vars expvar registry
func RegisterRoutes ¶
Types ¶
type DebugOptions ¶ added in v0.3.0
DebugOptions selects which optional debug handlers RegisterDebugHandlers mounts. Each handler is gated separately so an operator can enable, e.g., runtime metrics without exposing pprof.
type IngestionSnapshotter ¶
type IngestionSnapshotter interface {
IngestionDiagnostics() projectingestion.DiagnosticsSnapshot
}
type RuntimeOptions ¶
type RuntimeOptions struct {
Enabled bool
}
type RuntimeSnapshot ¶
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func NewService ¶
func NewService(ingestion IngestionSnapshotter, runtimeOptions RuntimeOptions) *Service
type Snapshot ¶
type Snapshot struct {
Ingestion projectingestion.DiagnosticsSnapshot `json:"ingestion"`
Runtime RuntimeSnapshot `json:"runtime,omitempty"`
}