telemetry

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2020 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetDefaultOutput

func GetDefaultOutput(sensors []*config.Sensor) string

GetDefaultOutput returns default output if available.

func GetGNMISubscriptions

func GetGNMISubscriptions(sensors []*config.Sensor) []*gpb.Subscription

GetGNMISubscriptions return gNMI subscription based on the sensors.

func GetKey

func GetKey(buf *bytes.Buffer, path []*gpb.PathElem) (string, map[string]string)

GetKey returns telemetry key and extracted labels.

func GetPathOutput

func GetPathOutput(sensors []*config.Sensor) map[string]string

GetPathOutput returns path to output map.

func GetValue

func GetValue(tv *gpb.TypedValue) (interface{}, error)

GetValue returns telemetry value.

func MergeLabels

func MergeLabels(keyLabels, prefixLabels map[string]string, prefix string) map[string]string

MergeLabels merges key labels with prefix labels.

Types

type DataStore

type DataStore map[string]interface{}

DataStore represents a metric and its meta data Meta data: - system_id - labels - timestamp - prefix

type DeviceFilterOpt

type DeviceFilterOpt func(config.Device) bool

DeviceFilterOpt represents filter option

type DeviceFilterOpts

type DeviceFilterOpts struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

DeviceFilterOpts represents assigned filter options

type ExtDSChan

type ExtDSChan chan ExtDataStore

ExtDSChan represents ExtDataStore channel

type ExtDataStore

type ExtDataStore struct {
	Output string
	DS     DataStore
}

ExtDataStore represents datastore with output identification

type NMI

type NMI interface {
	Start(context.Context) error
}

NMI represents a NMI

type NMIFactory

type NMIFactory func(*zap.Logger, *grpc.ClientConn, []*config.Sensor, ExtDSChan) NMI

NMIFactory is a function that returns a new instance of a NMI

type Registrar

type Registrar struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

Registrar represents NMI registry

func NewRegistrar

func NewRegistrar(lg *zap.Logger) *Registrar

NewRegistrar creates a new registrar instance

func (*Registrar) GetNMIFactory

func (tr *Registrar) GetNMIFactory(name string) (NMIFactory, bool)

GetNMIFactory returns requested NMI factory

func (*Registrar) Register

func (tr *Registrar) Register(name, version string, tf NMIFactory)

Register adds new NMI factory

type Telemetry

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

Telemetry represents telemetry

func New

func New(ctx context.Context, cfg config.Config, tr *Registrar, outChan ExtDSChan) *Telemetry

New creates a new telemetry

func (*Telemetry) AddFilterOpt

func (t *Telemetry) AddFilterOpt(index string, filterOpt DeviceFilterOpt)

AddFilterOpt adds filter option

func (*Telemetry) DelFilterOpt

func (t *Telemetry) DelFilterOpt(index string)

DelFilterOpt deletes filter option

func (*Telemetry) GetDevices

func (t *Telemetry) GetDevices() []config.Device

GetDevices returns devices based on the filters (if exist)

func (*Telemetry) Start

func (t *Telemetry) Start()

Start subscribes configured devices

func (*Telemetry) Update

func (t *Telemetry) Update()

Update updates device subscriptions subscribe/unsubscribe/resubscribe devices

Directories

Path Synopsis
mdt
jti
proto/GnmiJuniperTelemetryHeader
Package GnmiJuniperTelemetryHeader is a generated protocol buffer package.
Package GnmiJuniperTelemetryHeader is a generated protocol buffer package.
proto/GnmiJuniperTelemetryHeaderExtension
Package GnmiJuniperTelemetryHeaderExtension is a generated protocol buffer package.
Package GnmiJuniperTelemetryHeaderExtension is a generated protocol buffer package.

Jump to

Keyboard shortcuts

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