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 CollectJSONStream ¶
func CollectJSONStream(ctx context.Context, opts CollectJSONOptions) ([]byte, error)
CollectJSONStream provides a blocking process that reads new-line separated JSON documents from a file and creates FTDC data from these sources.
The Options structure allows you to define the collection intervals and also specify the source. The collector supports reading directly from an arbitrary IO reader, or from a file. The "follow" option allows you to watch the end of a file for new JSON documents, a la "tail -f".
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 CollectJSONOptions ¶
type CollectJSONOptions struct {
OutputFilePrefix string
SampleCount int
FlushInterval time.Duration
InputSource io.Reader `json:"-"`
FileName string
Follow bool
}
CollectJSONOptions specifies options for a JSON2FTDC collector. You must specify EITHER an input Source as a reader or a file name.
type CollectOptions ¶
type CollectOptions struct {
FlushInterval time.Duration
CollectionInterval time.Duration
SkipGolang bool
SkipSystem bool
SkipProcess bool
RunParallelCollectors bool
SampleCount int
Collectors Collectors
OutputFilePrefix string
}
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 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