monitor

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2024 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HttpChartPrefix = "charts"
)

Variables

View Source
var (
	SamplingRate         = time.Second
	SampleMaxSize  int64 = 86400
	SampleProfiles       = utils.NewStringSet("block", "goroutine", "heap", "mutex", "threadcreate")
)
View Source
var (
	// DataGroups collected profiles to return in "data" endpoint
	DataGroups = []DataGroup{GroupBytesAllocated, GroupGCPauses, GroupCPUUsage, GroupPprof}
	// PongTimeout is the time data feed would wait for pong message before it close the websocket connection
	PongTimeout = time.Minute
)
View Source
var Content embed.FS
View Source
var Module = &bootstrap.Module{
	Precedence: bootstrap.DebugPrecedence,
	Options: []fx.Option{
		fx.Provide(provideDataStorage, NewDataCollector),
		fx.Invoke(initialize),
	},
}

Functions

func NewDataCollector

func NewDataCollector(storage DataStorage) *dataCollector

func NewRedisDataStorage

func NewRedisDataStorage(ctx context.Context, cf redis.ClientFactory) *redisDataStorage

func Use

func Use()

Use Allow service to include this module in main()

Types

type CPUPair

type CPUPair struct {
	Ts   uint64  `json:"Ts"`
	User float64 `json:"User"`
	Sys  float64 `json:"Sys"`
}

func (*CPUPair) MarshalBinary

func (p *CPUPair) MarshalBinary() (data []byte, err error)

type ChartController

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

func NewChartController

func NewChartController(storage DataStorage, collector *dataCollector) *ChartController

func (*ChartController) ChartUI

func (c *ChartController) ChartUI(w http.ResponseWriter, r *http.Request)

func (*ChartController) Data

func (c *ChartController) Data(gc *gin.Context)

func (*ChartController) DataFeed

func (c *ChartController) DataFeed(gc *gin.Context)

func (*ChartController) Mappings

func (c *ChartController) Mappings() []web.Mapping

type ChartsForwardRequest

type ChartsForwardRequest struct {
	Path string `uri:"path"`
}

type DataGroup

type DataGroup string
const (
	GroupBytesAllocated DataGroup = "BytesAllocated"
	GroupGCPauses       DataGroup = "GcPauses"
	GroupCPUUsage       DataGroup = "CPUUsage"
	GroupPprof          DataGroup = "Pprof"
)

type DataStorage

type DataStorage interface {
	Read(ctx context.Context, groups ...DataGroup) (map[DataGroup]RawEntries, error)

	// Append save data entry
	Append(ctx context.Context, group DataGroup, entry interface{}, cap int64) error

	// AppendAll save all data entries, grouped by DataGroup
	AppendAll(ctx context.Context, data map[DataGroup]interface{}, cap int64) error
}

type Feed

type Feed struct {
	Ts             uint64
	BytesAllocated uint64
	GcPause        uint64
	CPUUser        float64
	CPUSys         float64
	Block          int
	Goroutine      int
	Heap           int
	Mutex          int
	Threadcreate   int
}

type PprofPair

type PprofPair struct {
	Ts           uint64 `json:"Ts"`
	Block        int    `json:"Block"`
	Goroutine    int    `json:"Goroutine"`
	Heap         int    `json:"Heap"`
	Mutex        int    `json:"Mutex"`
	Threadcreate int    `json:"Threadcreate"`
}

func (*PprofPair) MarshalBinary

func (p *PprofPair) MarshalBinary() (data []byte, err error)

type RawEntries

type RawEntries []string

func (RawEntries) MarshalJSON

func (v RawEntries) MarshalJSON() (data []byte, err error)

type SimplePair

type SimplePair struct {
	Ts    uint64 `json:"Ts"`
	Value uint64 `json:"Value"`
}

func (*SimplePair) MarshalBinary

func (p *SimplePair) MarshalBinary() (data []byte, err error)

Jump to

Keyboard shortcuts

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