Help us shape the future of Go! Take the 2026 Go Developer Survey

diagnostics

package
v2.12.0 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2026 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DiagnosticsService

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

DiagnosticsService gathers Go runtime, memory, and garbage-collector statistics for the diagnostics endpoints. It holds no external dependencies; WebSocket metrics and worker-goroutine counts are merged in at the handler layer to avoid an import cycle with the api/ws package.

func NewDiagnosticsService

func NewDiagnosticsService() *DiagnosticsService

NewDiagnosticsService returns a DiagnosticsService. startedAt is captured at construction (≈ process start) and used to report uptime.

func (*DiagnosticsService) Collect

Collect samples the current runtime, memory, and GC state.

LeakedGoroutines is the last-known leak count from the runtime; it does not trigger a leak-detection GC. Use ScanGoroutineLeaks for a fresh scan.

func (*DiagnosticsService) ScanGoroutineLeaks added in v2.9.0

func (s *DiagnosticsService) ScanGoroutineLeaks() (system.GoroutineLeakReport, error)

ScanGoroutineLeaks runs a leak-detection GC and returns the leaked-goroutine pprof text (debug=1). debug=2 would dump every goroutine, not only leaks.

Jump to

Keyboard shortcuts

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