metrics

package
v0.0.0-...-d5f3c33 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2019 License: Apache-2.0, Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package metrics includes data types used for Golang runtime and system metrics collection

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CollectRuntime

func CollectRuntime(ctx context.Context, opts CollectOptions) error

CollectRuntime starts a blocking background process that that collects metrics about the current process, the go runtime, and the underlying system.

Types

type CollectOptions

type CollectOptions struct {
	OutputFilePrefix      string
	SampleCount           int
	FlushInterval         time.Duration
	CollectionInterval    time.Duration
	SkipGolang            bool
	SkipSystem            bool
	SkipProcess           bool
	Collectors            Collectors
	RunParallelCollectors bool
}

CollectOptions are the settings to provide the behavior of the collection process process.

func NewCollectOptions

func NewCollectOptions(prefix string) CollectOptions

NewCollectOptions creates a valid, populated collection options structure, collecting data every minute, rotating files every 24 hours.

func (CollectOptions) Validate

func (opts CollectOptions) Validate() error

Validate checks the Collect option settings and ensures that all values are reasonable.

type Collectors

type Collectors []CustomCollector

func (Collectors) Len

func (c Collectors) Len() int

func (Collectors) Less

func (c Collectors) Less(i, j int) bool

func (Collectors) Swap

func (c Collectors) Swap(i, j int)

type CustomCollector

type CustomCollector struct {
	Name      string
	Operation func(context.Context) *bsonx.Document
}

type Runtime

type Runtime struct {
	ID        int                    `json:"id" bson:"id"`
	Timestamp time.Time              `json:"ts" bson:"ts"`
	PID       int                    `json:"pid" bson:"pid"`
	Golang    *message.GoRuntimeInfo `json:"golang,omitempty" bson:"golang,omitempty"`
	System    *message.SystemInfo    `json:"system,omitempty" bson:"system,omitempty"`
	Process   *message.ProcessInfo   `json:"process,omitempty" bson:"process,omitempty"`
}

Runtime provides an aggregated view for

func (*Runtime) MarshalBSON

func (r *Runtime) MarshalBSON() ([]byte, error)

func (*Runtime) UnmarshalBSON

func (r *Runtime) UnmarshalBSON(b []byte) error

Jump to

Keyboard shortcuts

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