Documentation ¶
Overview ¶
Package metric defines things that we measure to determine how well a task is performing
Package metric implements the queue metric for NSQ (http://nsq.io/).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AzureQueueMetric ¶
type AzureQueueMetric struct {
// contains filtered or unexported fields
}
AzureQueueMetric is used to measure the length of an Azure Storage Accout Queue
func NewAzureQueueMetric ¶
func NewAzureQueueMetric(queueName string) *AzureQueueMetric
NewAzureQueueMetric makes sure we have access to the Azure client
func (*AzureQueueMetric) Current ¶
func (aqm *AzureQueueMetric) Current() int
Current reads out the value of the current queue length
func (*AzureQueueMetric) UpdateCurrent ¶
func (aqm *AzureQueueMetric) UpdateCurrent()
UpdateCurrent calls the Azure Storage API to get the queue length and stores the value in the metric.
type Metric ¶
type Metric interface { UpdateCurrent() Current() int }
Metric is something we measure. Each task is associated with a Metric and a Target that we want the Metric to stay close to.
type NSQMetric ¶
type NSQMetric struct {
// contains filtered or unexported fields
}
NSQMetric stores the current value.
func NewNSQMetric ¶
NewNSQMetric creates the metric.
func (*NSQMetric) UpdateCurrent ¶
func (nsqm *NSQMetric) UpdateCurrent()
UpdateCurrent sets the current queue length.
type NullMetric ¶
type NullMetric struct{}
NullMetric for cases such as Remainder rules, where we don't need to actually measure a current value
func (*NullMetric) Current ¶
func (n *NullMetric) Current() int
Current reads out the value of the current queue length - which is always 0 for the Null metric
func (*NullMetric) UpdateCurrent ¶
func (n *NullMetric) UpdateCurrent()
UpdateCurrent reads the value of the current metric, but this is a no-op for the Null metric
type SQSMetric ¶
type SQSMetric struct {
// contains filtered or unexported fields
}
SQSMetric is used to measure the length of an SQS Queue
func NewSQSMetric ¶
NewSQSMetric makes sure we have access to the SQS client
func (*SQSMetric) UpdateCurrent ¶
func (sm *SQSMetric) UpdateCurrent()
UpdateCurrent calls the SQS API to get the queue length and stores the value in the metric.
type StatsData ¶
type StatsData struct {
Topics []Topic `json:"topics"`
}
StatsData from NSQ stats API.
type StatsMessage ¶
type StatsMessage struct {
Data StatsData `json:"data"`
}
StatsMessage from NSQ stats API.
type ToyMetric ¶
type ToyMetric struct {
SettableCurrent int
}
ToyMetric is only used for testing, but we can set its value
func (*ToyMetric) UpdateCurrent ¶
func (t *ToyMetric) UpdateCurrent()
UpdateCurrent reads the value of the current metric, but this is a no-op for the Toy metric