runtime

package
v0.0.0-...-8c84044 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2026 License: Apache-2.0 Imports: 8 Imported by: 3

Documentation

Overview

Package runtime provides configuration to publish Go runtime statistics and HTTP helpers to expose Go runtime profiling data

Index

Constants

View Source
const (
	ProfilingEnabled  = "enabled"
	ProfilingDisabled = "disabled"
)
View Source
const (
	// ProfilingPortEnvKey specified the name of an environment variable that
	// may be used to override the default profiling port.
	ProfilingPortEnvKey = "PROFILING_PORT"

	// ProfilingDefaultPort specifies the default port where profiling data is available when profiling is enabled
	ProfilingDefaultPort = 8008
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Profiling      string        `json:"profiling,omitempty"`
	ExportInterval time.Duration `json:"exportInterval,omitempty"`
}

func DefaultConfig

func DefaultConfig() Config

func NewFromMap

func NewFromMap(m map[string]string) (Config, error)

func (*Config) ProfilingEnabled

func (c *Config) ProfilingEnabled() bool

func (*Config) Validate

func (c *Config) Validate() error

type ProfilingHandler

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

func NewProfilingHandler

func NewProfilingHandler() *ProfilingHandler

NewHandler create a new ProfilingHandler which serves runtime profiling data according to the given context path

func (*ProfilingHandler) ServeHTTP

func (h *ProfilingHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

func (*ProfilingHandler) SetEnabled

func (h *ProfilingHandler) SetEnabled(enabled bool) (old bool)

type ProfilingServer

type ProfilingServer struct {
	*http.Server
	*ProfilingHandler
}

func NewProfilingServer

func NewProfilingServer() *ProfilingServer

NewServer creates a new http server that exposes profiling data on the default profiling port

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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