client

package
v0.0.0-...-94b8695 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2023 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

func DeepFieldsNew

func DeepFieldsNew(iface interface{}) []metrics.Metric

DeepFieldsNew recursively collect full array of metrics from stats

func NewMetricStruct

func NewMetricStruct(mname string, mtype string, ival reflect.Value) *metrics.Metric

NewMetricStruct create metric from string parameters

Types

type Client

type Client struct {
	// array of metrics
	Metrics Metrics

	// server address
	Address string

	// Path to file where mem stats will be saved
	MemProfile string
	// Exchange mode
	ExchangeMode string
	// contains filtered or unexported fields
}

func NewClient

func NewClient(settings *config.ClientFlags) (*Client, error)

NewClient creates instance of client

func (*Client) PushMetricsJSON

func (cli *Client) PushMetricsJSON(ctx context.Context)

PushMetricsJSON push metrics to server

func (*Client) ReadMetrics

func (cli *Client) ReadMetrics(ctx context.Context)

ReadMetrics reads memory stats and send it to queue

func (*Client) ReadSpecificMetrics

func (cli *Client) ReadSpecificMetrics(ctx context.Context)

ReadSpecificMetrics reads special stats and send it to queue

func (*Client) Run

func (cli *Client) Run(ctx context.Context)

Run start client - read and push threads

func (*Client) Stop

func (cli *Client) Stop()

type Metric

type Metric interface {
	GetName() string
	GetType() string
	GetValue() any
	GetTypeForQuery() string
}

func DeepFields

func DeepFields(iface interface{}) []Metric

DeepFields recursively collect full array of metrics from stats

func NewMetric

func NewMetric(mname string, mtype string, ival reflect.Value) Metric

NewMetric create metric from string parameters

type Metrics

type Metrics struct {
	// All runtime memory stats
	runtime.MemStats
	// counts of reading stats attempts
	PollCount int64
	// random value
	RandomValue float64
}

Jump to

Keyboard shortcuts

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