Documentation ¶
Overview ¶
Plugins allows users to operate on statistics recorded for each circuit operation. Plugins should be careful to be lightweight as they will be called frequently.
Index ¶
- func InitializeGraphiteCollector(config *GraphiteCollectorConfig)
- func NewGraphiteCollector(name string) metricCollector.MetricCollector
- type GraphiteCollector
- func (g *GraphiteCollector) IncrementAttempts()
- func (g *GraphiteCollector) IncrementErrors()
- func (g *GraphiteCollector) IncrementFailures()
- func (g *GraphiteCollector) IncrementFallbackFailures()
- func (g *GraphiteCollector) IncrementFallbackSuccesses()
- func (g *GraphiteCollector) IncrementRejects()
- func (g *GraphiteCollector) IncrementShortCircuits()
- func (g *GraphiteCollector) IncrementSuccesses()
- func (g *GraphiteCollector) IncrementTimeouts()
- func (g *GraphiteCollector) Reset()
- func (g *GraphiteCollector) UpdateRunDuration(runDuration time.Duration)
- func (g *GraphiteCollector) UpdateTotalDuration(timeSinceStart time.Duration)
- type GraphiteCollectorConfig
- type StatsdCollector
- func (g *StatsdCollector) IncrementAttempts()
- func (g *StatsdCollector) IncrementErrors()
- func (g *StatsdCollector) IncrementFailures()
- func (g *StatsdCollector) IncrementFallbackFailures()
- func (g *StatsdCollector) IncrementFallbackSuccesses()
- func (g *StatsdCollector) IncrementRejects()
- func (g *StatsdCollector) IncrementShortCircuits()
- func (g *StatsdCollector) IncrementSuccesses()
- func (g *StatsdCollector) IncrementTimeouts()
- func (g *StatsdCollector) Reset()
- func (g *StatsdCollector) UpdateRunDuration(runDuration time.Duration)
- func (g *StatsdCollector) UpdateTotalDuration(timeSinceStart time.Duration)
- type StatsdCollectorClient
- type StatsdCollectorConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InitializeGraphiteCollector ¶
func InitializeGraphiteCollector(config *GraphiteCollectorConfig)
InitializeGraphiteCollector creates the connection to the graphite server and should be called before any metrics are recorded.
func NewGraphiteCollector ¶
func NewGraphiteCollector(name string) metricCollector.MetricCollector
NewGraphiteCollector creates a collector for a specific circuit. The prefix given to this circuit will be {config.Prefix}.{circuit_name}.{metric}. Circuits with "/" in their names will have them replaced with ".".
Types ¶
type GraphiteCollector ¶
type GraphiteCollector struct {
// contains filtered or unexported fields
}
GraphiteCollector fulfills the metricCollector interface allowing users to ship circuit stats to a graphite backend. To use users must call InitializeGraphiteCollector before circuits are started. Then register NewGraphiteCollector with metricCollector.Registry.Register(NewGraphiteCollector).
This Collector uses github.com/rcrowley/go-metrics for aggregation. See that repo for more details on how metrics are aggregated and expressed in graphite.
func (*GraphiteCollector) IncrementAttempts ¶
func (g *GraphiteCollector) IncrementAttempts()
IncrementAttempts increments the number of calls to this circuit. This registers as a counter in the graphite collector.
func (*GraphiteCollector) IncrementErrors ¶
func (g *GraphiteCollector) IncrementErrors()
IncrementErrors increments the number of unsuccessful attempts. Attempts minus Errors will equal successes within a time range. Errors are any result from an attempt that is not a success. This registers as a counter in the graphite collector.
func (*GraphiteCollector) IncrementFailures ¶
func (g *GraphiteCollector) IncrementFailures()
IncrementFailures increments the number of requests that fail. This registers as a counter in the graphite collector.
func (*GraphiteCollector) IncrementFallbackFailures ¶
func (g *GraphiteCollector) IncrementFallbackFailures()
IncrementFallbackFailures increments the number of failures that occurred during the execution of the fallback function. This registers as a counter in the graphite collector.
func (*GraphiteCollector) IncrementFallbackSuccesses ¶
func (g *GraphiteCollector) IncrementFallbackSuccesses()
IncrementFallbackSuccesses increments the number of successes that occurred during the execution of the fallback function. This registers as a counter in the graphite collector.
func (*GraphiteCollector) IncrementRejects ¶
func (g *GraphiteCollector) IncrementRejects()
IncrementRejects increments the number of requests that are rejected. This registers as a counter in the graphite collector.
func (*GraphiteCollector) IncrementShortCircuits ¶
func (g *GraphiteCollector) IncrementShortCircuits()
IncrementShortCircuits increments the number of requests that short circuited due to the circuit being open. This registers as a counter in the graphite collector.
func (*GraphiteCollector) IncrementSuccesses ¶
func (g *GraphiteCollector) IncrementSuccesses()
IncrementSuccesses increments the number of requests that succeed. This registers as a counter in the graphite collector.
func (*GraphiteCollector) IncrementTimeouts ¶
func (g *GraphiteCollector) IncrementTimeouts()
IncrementTimeouts increments the number of timeouts that occurred in the circuit breaker. This registers as a counter in the graphite collector.
func (*GraphiteCollector) Reset ¶
func (g *GraphiteCollector) Reset()
Reset is a noop operation in this collector.
func (*GraphiteCollector) UpdateRunDuration ¶
func (g *GraphiteCollector) UpdateRunDuration(runDuration time.Duration)
UpdateRunDuration updates the internal counter of how long the last run took. This registers as a timer in the graphite collector.
func (*GraphiteCollector) UpdateTotalDuration ¶
func (g *GraphiteCollector) UpdateTotalDuration(timeSinceStart time.Duration)
UpdateTotalDuration updates the internal counter of how long we've run for. This registers as a timer in the graphite collector.
type GraphiteCollectorConfig ¶
type GraphiteCollectorConfig struct { // GraphiteAddr is the tcp address of the graphite server GraphiteAddr *net.TCPAddr // Prefix is the prefix that will be prepended to all metrics sent from this collector. Prefix string // TickInterval spcifies the period that this collector will send metrics to the server. TickInterval time.Duration }
GraphiteCollectorConfig provides configuration that the graphite client will need.
type StatsdCollector ¶
type StatsdCollector struct {
// contains filtered or unexported fields
}
StatsdCollector fulfills the metricCollector interface allowing users to ship circuit stats to a Statsd backend. To use users must call InitializeStatsdCollector before circuits are started. Then register NewStatsdCollector with metricCollector.Registry.Register(NewStatsdCollector).
This Collector uses https://github.com/cactus/go-statsd-client/ for transport.
func (*StatsdCollector) IncrementAttempts ¶
func (g *StatsdCollector) IncrementAttempts()
IncrementAttempts increments the number of calls to this circuit. This registers as a counter in the Statsd collector.
func (*StatsdCollector) IncrementErrors ¶
func (g *StatsdCollector) IncrementErrors()
IncrementErrors increments the number of unsuccessful attempts. Attempts minus Errors will equal successes within a time range. Errors are any result from an attempt that is not a success. This registers as a counter in the Statsd collector.
func (*StatsdCollector) IncrementFailures ¶
func (g *StatsdCollector) IncrementFailures()
IncrementFailures increments the number of requests that fail. This registers as a counter in the Statsd collector.
func (*StatsdCollector) IncrementFallbackFailures ¶
func (g *StatsdCollector) IncrementFallbackFailures()
IncrementFallbackFailures increments the number of failures that occurred during the execution of the fallback function. This registers as a counter in the Statsd collector.
func (*StatsdCollector) IncrementFallbackSuccesses ¶
func (g *StatsdCollector) IncrementFallbackSuccesses()
IncrementFallbackSuccesses increments the number of successes that occurred during the execution of the fallback function. This registers as a counter in the Statsd collector.
func (*StatsdCollector) IncrementRejects ¶
func (g *StatsdCollector) IncrementRejects()
IncrementRejects increments the number of requests that are rejected. This registers as a counter in the Statsd collector.
func (*StatsdCollector) IncrementShortCircuits ¶
func (g *StatsdCollector) IncrementShortCircuits()
IncrementShortCircuits increments the number of requests that short circuited due to the circuit being open. This registers as a counter in the Statsd collector.
func (*StatsdCollector) IncrementSuccesses ¶
func (g *StatsdCollector) IncrementSuccesses()
IncrementSuccesses increments the number of requests that succeed. This registers as a counter in the Statsd collector.
func (*StatsdCollector) IncrementTimeouts ¶
func (g *StatsdCollector) IncrementTimeouts()
IncrementTimeouts increments the number of timeouts that occurred in the circuit breaker. This registers as a counter in the Statsd collector.
func (*StatsdCollector) Reset ¶
func (g *StatsdCollector) Reset()
Reset is a noop operation in this collector.
func (*StatsdCollector) UpdateRunDuration ¶
func (g *StatsdCollector) UpdateRunDuration(runDuration time.Duration)
UpdateRunDuration updates the internal counter of how long the last run took. This registers as a timer in the Statsd collector.
func (*StatsdCollector) UpdateTotalDuration ¶
func (g *StatsdCollector) UpdateTotalDuration(timeSinceStart time.Duration)
UpdateTotalDuration updates the internal counter of how long we've run for. This registers as a timer in the Statsd collector.
type StatsdCollectorClient ¶
type StatsdCollectorClient struct {
// contains filtered or unexported fields
}
func InitializeStatsdCollector ¶
func InitializeStatsdCollector(config *StatsdCollectorConfig) (*StatsdCollectorClient, error)
InitializeStatsdCollector creates the connection to the Statsd server and should be called before any metrics are recorded.
Users should ensure to call Close() on the client.
func (*StatsdCollectorClient) NewStatsdCollector ¶
func (s *StatsdCollectorClient) NewStatsdCollector(name string) metricCollector.MetricCollector
NewStatsdCollector creates a collector for a specific circuit. The prefix given to this circuit will be {config.Prefix}.{circuit_name}.{metric}. Circuits with "/" in their names will have them replaced with ".".
type StatsdCollectorConfig ¶
type StatsdCollectorConfig struct { // StatsdAddr is the tcp address of the Statsd server StatsdAddr string // Prefix is the prefix that will be prepended to all metrics sent from this collector. Prefix string }
StatsdCollectorConfig provides configuration that the Statsd client will need.