discover

package
v0.0.0-...-a3a5c94 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2021 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetDokerLogInInstance

func GetDokerLogInInstance(etcdClient *clientv3.Client, conf conf.DiscoverConf, serviceID string) (string, error)

GetDokerLogInInstance - get application log receiving node

func SaveDockerLogInInstance

func SaveDockerLogInInstance(etcdClient *clientv3.Client, conf conf.DiscoverConf, serviceID, instanceID string) error

SaveDockerLogInInstance - store the correspondence between service and node

Types

type EtcdDiscoverManager

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

EtcdDiscoverManager - automatic discovery based on ETCD

func (*EtcdDiscoverManager) CancellationInstance

func (d *EtcdDiscoverManager) CancellationInstance(instance *Instance)

CancellationInstance

func (*EtcdDiscoverManager) GetCurrentInstance

func (d *EtcdDiscoverManager) GetCurrentInstance() Instance

GetCurrentInstance

func (*EtcdDiscoverManager) GetInstance

func (d *EtcdDiscoverManager) GetInstance(id string) *Instance

GetInstance

func (*EtcdDiscoverManager) InstanceCheckHealth

func (d *EtcdDiscoverManager) InstanceCheckHealth(instanceID string) string

InstanceCheckHealth - will be called by distribution, when the node is found to be abnormal Check here, if the node is offline, return delete If the node is not offline, mark it as abnormal, return abnormal If the node is judged to be faulty by the cluster, return delete

func (*EtcdDiscoverManager) MonitorAddInstances

func (d *EtcdDiscoverManager) MonitorAddInstances() chan *Instance

MonitorAddInstances

func (*EtcdDiscoverManager) MonitorDelInstances

func (d *EtcdDiscoverManager) MonitorDelInstances() chan *Instance

MonitorDelInstances

func (*EtcdDiscoverManager) MonitorUpdateInstances

func (d *EtcdDiscoverManager) MonitorUpdateInstances() chan *Instance

MonitorUpdateInstances

func (*EtcdDiscoverManager) RegisteredInstance

func (d *EtcdDiscoverManager) RegisteredInstance(host string, port int, stopRegister *bool) *Instance

RegisteredInstance

func (*EtcdDiscoverManager) Run

func (d *EtcdDiscoverManager) Run() error

Run

func (*EtcdDiscoverManager) Scrape

func (d *EtcdDiscoverManager) Scrape(ch chan<- prometheus.Metric, namespace, exporter string) error

Scrape prometheus monitor metrics

func (*EtcdDiscoverManager) Stop

func (d *EtcdDiscoverManager) Stop()

Stop

func (*EtcdDiscoverManager) UpdateInstance

func (d *EtcdDiscoverManager) UpdateInstance(instance *Instance)

UpdateInstance

type Instance

type Instance struct {
	HostID          string
	HostIP          net.IP
	PubPort         int
	DockerLogPort   int
	WebPort         int
	HostName        string
	Status          string
	TagNumber       int //when TagNumber is greater than half of the total number of clusters, this node is offline
	LastHealthCheck time.Time
}

Instance

func DeleteSlice

func DeleteSlice(source []*Instance, index int) []*Instance

DeleteSlice - delete an element from the array

type Manager

type Manager interface {
	RegisteredInstance(host string, port int, stopRegister *bool) *Instance
	CancellationInstance(instance *Instance)
	MonitorAddInstances() chan *Instance
	MonitorDelInstances() chan *Instance
	MonitorUpdateInstances() chan *Instance
	GetInstance(string) *Instance
	InstanceCheckHealth(string) string
	Run() error
	GetCurrentInstance() Instance
	Stop()
	Scrape(ch chan<- prometheus.Metric, namespace, exporter string) error
}

Manager - dynamic node discovery manager

func New

func New(etcdClient *clientv3.Client, conf conf.DiscoverConf, log *logrus.Entry) Manager

New

type Node

type Node struct {
	Key   string
	Value string
}

Jump to

Keyboard shortcuts

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