collector

package
v0.19.0 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2021 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Collector

type Collector struct {
	Config *Config

	Subscriptions map[string]*types.SubscriptionConfig

	Outputs map[string]outputs.Output

	Inputs map[string]inputs.Input

	Targets map[string]*target.Target

	EventProcessorsConfig map[string]map[string]interface{}
	// contains filtered or unexported fields
}

Collector //

func New added in v0.18.0

func New(config *Config, targetConfigs map[string]*types.TargetConfig, opts ...CollectorOption) *Collector

New //

func (*Collector) AddInput added in v0.7.0

func (c *Collector) AddInput(name string, cfg map[string]interface{}) error

AddInput adds an input called name, with config cfg to the collector instance

func (*Collector) AddOutput added in v0.5.1

func (c *Collector) AddOutput(name string, cfg map[string]interface{}) error

AddOutput initializes an output called name, with config cfg if it does not already exist

func (*Collector) AddSubscriptionConfig added in v0.5.1

func (c *Collector) AddSubscriptionConfig(sc *types.SubscriptionConfig) error

AddSubscriptionConfig adds a subscriptionConfig sc to Collector's map if it does not already exists

func (*Collector) AddTarget added in v0.5.1

func (c *Collector) AddTarget(tc *types.TargetConfig) error

AddTarget initializes a target based on *TargetConfig

func (*Collector) Capabilities added in v0.5.0

func (c *Collector) Capabilities(ctx context.Context, tName string, ext ...*gnmi_ext.Extension) (*gnmi.CapabilityResponse, error)

func (*Collector) CreateTarget added in v0.14.0

func (c *Collector) CreateTarget(name string) error

func (*Collector) DeleteOutput added in v0.5.1

func (c *Collector) DeleteOutput(name string) error

func (*Collector) DeleteSubscription added in v0.5.1

func (c *Collector) DeleteSubscription(name string) error

func (*Collector) DeleteTarget added in v0.5.1

func (c *Collector) DeleteTarget(ctx context.Context, name string) error

func (*Collector) Export added in v0.4.2

func (c *Collector) Export(ctx context.Context, rsp *gnmi.SubscribeResponse, m outputs.Meta, outs ...string)

func (*Collector) Get added in v0.5.0

func (c *Collector) Get(ctx context.Context, tName string, req *gnmi.GetRequest) (*gnmi.GetResponse, error)

func (*Collector) GetModels added in v0.5.0

func (c *Collector) GetModels(ctx context.Context, tName string) ([]*gnmi.ModelData, error)

func (*Collector) InitInputs added in v0.7.0

func (c *Collector) InitInputs(ctx context.Context)

func (*Collector) InitOutput added in v0.5.1

func (c *Collector) InitOutput(ctx context.Context, name string, tcs map[string]*types.TargetConfig)

func (*Collector) InitOutputs added in v0.5.1

func (c *Collector) InitOutputs(ctx context.Context)

func (*Collector) PolledSubscriptionsTargets

func (c *Collector) PolledSubscriptionsTargets() map[string][]string

PolledSubscriptionsTargets returns a map of target name to a list of subscription names that have Mode == POLL

func (*Collector) Set added in v0.5.0

func (c *Collector) Set(ctx context.Context, tName string, req *gnmi.SetRequest) (*gnmi.SetResponse, error)

func (*Collector) Start

func (c *Collector) Start(ctx context.Context)

Start start the prometheus server as well as a goroutine per target selecting on the response chan, the error chan and the ctx.Done() chan

func (*Collector) StopTarget added in v0.7.0

func (c *Collector) StopTarget(ctx context.Context, name string) error

func (*Collector) Subscribe

func (c *Collector) Subscribe(ctx context.Context, tName string) error

Subscribe //

func (*Collector) SubscribeOnce added in v0.8.0

func (c *Collector) SubscribeOnce(ctx context.Context, tName string) error

func (*Collector) TargetPoll

func (c *Collector) TargetPoll(targetName, subscriptionName string) (*gnmi.SubscribeResponse, error)

TargetPoll sends a gnmi.SubscribeRequest_Poll to targetName and returns the response and an error, it uses the targetName and the subscriptionName strings to find the gnmi.GNMI_SubscribeClient

func (*Collector) TargetSubscribeOnce added in v0.8.0

func (c *Collector) TargetSubscribeOnce(ctx context.Context, name string) error

func (*Collector) TargetSubscribePoll added in v0.8.0

func (c *Collector) TargetSubscribePoll(ctx context.Context, name string)

func (*Collector) TargetSubscribeStream added in v0.8.0

func (c *Collector) TargetSubscribeStream(ctx context.Context, name string)

type CollectorOption added in v0.4.0

type CollectorOption func(c *Collector)

func WithCache added in v0.18.0

func WithCache(ch *cache.Cache) CollectorOption

func WithDialOptions added in v0.4.0

func WithDialOptions(dialOptions []grpc.DialOption) CollectorOption

func WithEventProcessors added in v0.6.0

func WithEventProcessors(eps map[string]map[string]interface{}) CollectorOption

func WithInputs added in v0.7.0

func WithInputs(inputsConfig map[string]map[string]interface{}) CollectorOption

func WithLocker added in v0.7.0

func WithLocker(locker lockers.Locker) CollectorOption

func WithLogger added in v0.4.0

func WithLogger(logger *log.Logger) CollectorOption

func WithOutputs added in v0.4.0

func WithOutputs(outs map[string]map[string]interface{}) CollectorOption

func WithPrometheusRegistry added in v0.18.0

func WithPrometheusRegistry(reg *prometheus.Registry) CollectorOption

func WithProtoDescriptor added in v0.9.0

func WithProtoDescriptor(d desc.Descriptor) CollectorOption

func WithSubscriptions added in v0.4.0

func WithSubscriptions(subs map[string]*types.SubscriptionConfig) CollectorOption

type Config

type Config struct {
	Name                string
	Debug               bool
	Format              string
	TargetReceiveBuffer uint
	RetryTimer          time.Duration
	ClusterName         string
	LockRetryTimer      time.Duration
}

Config is the collector config

Jump to

Keyboard shortcuts

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