peripheral

package
v0.0.0-...-b463ae7 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2022 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Conn

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

func NewConnectivity

func NewConnectivity(
	id uint64,
	ec *server.ExtensionContext,
) *Conn

func (*Conn) Close

func (c *Conn) Close() error

func (*Conn) CollectMetrics

func (c *Conn) CollectMetrics(
	ctx context.Context, params map[string]string,
) ([]*arhatgopb.PeripheralMetricsMsg_Value, error)

CollectMetrics collects all existing metrics for one metric kind

func (*Conn) Operate

func (c *Conn) Operate(ctx context.Context, params map[string]string, data []byte) ([][]byte, error)

Operate the peripheral via established connection

type Manager

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

func NewManager

func NewManager(ctx context.Context, config *conf.PeripheralExtensionConfig) *Manager

func (*Manager) CacheMetrics

func (m *Manager) CacheMetrics(metrics []*dto.MetricFamily)

func (*Manager) Cleanup

func (m *Manager) Cleanup()

nolint:unused

func (*Manager) CollectMetrics

func (m *Manager) CollectMetrics(peripheralIDs ...string) (
	metricsForNode []*dto.MetricFamily,
	paramsForAgent []map[string]string,
	metricsForAgent [][]*dto.MetricFamily,
)

nolint:gocyclo

func (*Manager) CreateExtensionHandleFunc

func (m *Manager) CreateExtensionHandleFunc(
	extensionName string,
) (server.ExtensionHandleFunc, server.OutOfBandMsgHandleFunc)

func (*Manager) Delete

func (m *Manager) Delete(ids ...string) (result []*aranyagopb.PeripheralStatusMsg)

func (*Manager) Ensure

func (m *Manager) Ensure(cmd *aranyagopb.PeripheralEnsureCmd) (err error)

func (*Manager) GetAllStatuses

func (m *Manager) GetAllStatuses() []*aranyagopb.PeripheralStatusMsg

func (*Manager) GetStatus

func (m *Manager) GetStatus(peripheralID string) *aranyagopb.PeripheralStatusMsg

func (*Manager) Operate

func (m *Manager) Operate(ctx context.Context, peripheralID, operationID string, data []byte) ([][]byte, error)

func (*Manager) RetrieveCachedMetrics

func (m *Manager) RetrieveCachedMetrics() interface{}

type Metric

type Metric struct {
	Name      string
	Value     float64
	Timestamp int64
	ValueType dto.MetricType

	ReportKey          MetricReportKey
	ParamsForReporting map[string]string
}

type MetricReportKey

type MetricReportKey struct {
	ReporterName  string
	ParamsHashHex string
}

type MetricReportSpec

type MetricReportSpec struct {
	Metrics *dto.MetricFamily

	ParamsForReporting map[string]string
}

MetricReportSpec defines how to report this metric

type MetricSpec

type MetricSpec struct {
	Name                string
	ValueType           aranyagopb.PeripheralMetric_ValueType
	ParamsForCollecting map[string]string

	ReportKey          MetricReportKey
	ParamsForReporting map[string]string
}

MetricSpec defines how to collect one metric from peripheral

type MetricsCache

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

func NewMetricsCache

func NewMetricsCache(maxCacheTime time.Duration) *MetricsCache

func (*MetricsCache) CacheMetrics

func (m *MetricsCache) CacheMetrics(metrics []*dto.MetricFamily)

func (*MetricsCache) RetrieveCachedMetrics

func (m *MetricsCache) RetrieveCachedMetrics() []*dto.MetricFamily

type MetricsReporter

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

func NewMetricsReporter

func NewMetricsReporter(
	ctx context.Context,
	connectorHashHex string,
	conn *Conn,
) *MetricsReporter

func (*MetricsReporter) Close

func (r *MetricsReporter) Close() error

func (*MetricsReporter) ReportMetrics

func (r *MetricsReporter) ReportMetrics(params map[string]string, metrics []*dto.MetricFamily) error

func (MetricsReporter) Status

func (d MetricsReporter) Status() *aranyagopb.PeripheralStatusMsg

type Peripheral

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

func NewPeripheral

func NewPeripheral(
	ctx context.Context,
	name string,
	connector *Conn,
	operations []*aranyagopb.PeripheralOperation,
	metrics []*aranyagopb.PeripheralMetric,
) *Peripheral

func (*Peripheral) Close

func (d *Peripheral) Close() error

func (*Peripheral) CollectMetrics

func (d *Peripheral) CollectMetrics(resultCh chan<- *Metric)

CollectMetrics will collect all metrics configured when creating this peripheral and close the resultCh when finished

func (*Peripheral) Operate

func (d *Peripheral) Operate(ctx context.Context, id string, data []byte) ([][]byte, error)

func (Peripheral) Status

func (d Peripheral) Status() *aranyagopb.PeripheralStatusMsg

Jump to

Keyboard shortcuts

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