discovery

package
v3.2.5+incompatible Latest Latest
Warning

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

Go to latest
Published: May 27, 2021 License: Apache-2.0 Imports: 9 Imported by: 10

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func StopMonitoring

func StopMonitoring()

StopMonitoring stops monitoring all the queues

Types

type AggregatedDiscoveryMetrics

type AggregatedDiscoveryMetrics struct {
	FirstSeen                       time.Time // timestamp of the first data seen
	LastSeen                        time.Time // timestamp of the last data seen
	CountDistinctInstanceKeys       int       // number of distinct Instances seen (note: this may not be true: distinct = succeeded + failed)
	CountDistinctOkInstanceKeys     int       // number of distinct Instances which succeeded
	CountDistinctFailedInstanceKeys int       // number of distinct Instances which failed
	FailedDiscoveries               uint64    // number of failed discoveries
	SuccessfulDiscoveries           uint64    // number of successful discoveries
	MeanTotalSeconds                float64
	MeanBackendSeconds              float64
	MeanInstanceSeconds             float64
	FailedMeanTotalSeconds          float64
	FailedMeanBackendSeconds        float64
	FailedMeanInstanceSeconds       float64
	MaxTotalSeconds                 float64
	MaxBackendSeconds               float64
	MaxInstanceSeconds              float64
	FailedMaxTotalSeconds           float64
	FailedMaxBackendSeconds         float64
	FailedMaxInstanceSeconds        float64
	MedianTotalSeconds              float64
	MedianBackendSeconds            float64
	MedianInstanceSeconds           float64
	FailedMedianTotalSeconds        float64
	FailedMedianBackendSeconds      float64
	FailedMedianInstanceSeconds     float64
	P95TotalSeconds                 float64
	P95BackendSeconds               float64
	P95InstanceSeconds              float64
	FailedP95TotalSeconds           float64
	FailedP95BackendSeconds         float64
	FailedP95InstanceSeconds        float64
}

AggregatedDiscoveryMetrics contains aggregated metrics for instance discovery. Called from api/discovery-metrics-aggregated/:seconds

func AggregatedSince

AggregatedSince returns a large number of aggregated metrics based on the raw metrics collected since the given time.

type AggregatedQueueMetrics

type AggregatedQueueMetrics struct {
	ActiveMinEntries    float64
	ActiveMeanEntries   float64
	ActiveMedianEntries float64
	ActiveP95Entries    float64
	ActiveMaxEntries    float64
	QueuedMinEntries    float64
	QueuedMeanEntries   float64
	QueuedMedianEntries float64
	QueuedP95Entries    float64
	QueuedMaxEntries    float64
}

AggregatedQueueMetrics contains aggregate information some part queue metrics

type Metric

type Metric struct {
	Timestamp       time.Time        // time the collection was taken
	InstanceKey     inst.InstanceKey // instance being monitored
	BackendLatency  time.Duration    // time taken talking to the backend
	InstanceLatency time.Duration    // time taken talking to the instance
	TotalLatency    time.Duration    // total time taken doing the discovery
	Err             error            // error (if applicable) doing the discovery process
}

Metric holds a set of information of instance discovery metrics

func (Metric) When

func (m Metric) When() time.Time

When did the metric happen

type MetricJSON

type MetricJSON struct {
	Timestamp              time.Time
	Hostname               string
	Port                   int
	BackendLatencySeconds  formattedFloat
	InstanceLatencySeconds formattedFloat
	TotalLatencySeconds    formattedFloat
	Err                    error
}

MetricJSON holds a structure which represents some discovery latency information

func JSONSince

func JSONSince(c *collection.Collection, t time.Time) ([](MetricJSON), error)

JSONSince returns an API response of discovery metric collection information in a printable JSON format.

type Queue

type Queue struct {
	sync.Mutex
	// contains filtered or unexported fields
}

Queue contains information for managing discovery requests

func CreateOrReturnQueue

func CreateOrReturnQueue(name string) *Queue

CreateOrReturnQueue allows for creation of a new discovery queue or returning a pointer to an existing one given the name.

func (*Queue) AggregatedDiscoveryQueueMetrics

func (q *Queue) AggregatedDiscoveryQueueMetrics(period int) *AggregatedQueueMetrics

AggregatedDiscoveryQueueMetrics Returns some aggregate statistics based on the period (last N entries) requested. We store up to config.Config.DiscoveryQueueMaxStatisticsSize values and collect once a second so we expect period to be a smaller value.

func (*Queue) Consume

func (q *Queue) Consume() inst.InstanceKey

Consume fetches a key to process; blocks if queue is empty. Release must be called once after Consume.

func (*Queue) DiscoveryQueueMetrics

func (q *Queue) DiscoveryQueueMetrics(period int) []QueueMetric

DiscoveryQueueMetrics returns some raw queue metrics based on the period (last N entries) requested.

func (*Queue) Push

func (q *Queue) Push(key inst.InstanceKey)

Push enqueues a key if it is not on a queue and is not being processed; silently returns otherwise.

func (*Queue) QueueLen

func (q *Queue) QueueLen() int

QueueLen returns the length of the queue (channel size + queued size)

func (*Queue) Release

func (q *Queue) Release(key inst.InstanceKey)

Release removes a key from a list of being processed keys which allows that key to be pushed into the queue again.

type QueueMetric

type QueueMetric struct {
	Active int
	Queued int
}

QueueMetric contains the queue's active and queued sizes

Jump to

Keyboard shortcuts

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