metricCollector - ActiveState ActiveGo 1.8
...

Package metricCollector

import "github.com/afex/hystrix-go/hystrix/metric_collector"
Overview
Index

Overview ▾

Index ▾

Variables
type DefaultMetricCollector
    func (d *DefaultMetricCollector) Errors() *rolling.Number
    func (d *DefaultMetricCollector) Failures() *rolling.Number
    func (d *DefaultMetricCollector) FallbackFailures() *rolling.Number
    func (d *DefaultMetricCollector) FallbackSuccesses() *rolling.Number
    func (d *DefaultMetricCollector) IncrementAttempts()
    func (d *DefaultMetricCollector) IncrementErrors()
    func (d *DefaultMetricCollector) IncrementFailures()
    func (d *DefaultMetricCollector) IncrementFallbackFailures()
    func (d *DefaultMetricCollector) IncrementFallbackSuccesses()
    func (d *DefaultMetricCollector) IncrementRejects()
    func (d *DefaultMetricCollector) IncrementShortCircuits()
    func (d *DefaultMetricCollector) IncrementSuccesses()
    func (d *DefaultMetricCollector) IncrementTimeouts()
    func (d *DefaultMetricCollector) NumRequests() *rolling.Number
    func (d *DefaultMetricCollector) Rejects() *rolling.Number
    func (d *DefaultMetricCollector) Reset()
    func (d *DefaultMetricCollector) RunDuration() *rolling.Timing
    func (d *DefaultMetricCollector) ShortCircuits() *rolling.Number
    func (d *DefaultMetricCollector) Successes() *rolling.Number
    func (d *DefaultMetricCollector) Timeouts() *rolling.Number
    func (d *DefaultMetricCollector) TotalDuration() *rolling.Timing
    func (d *DefaultMetricCollector) UpdateRunDuration(runDuration time.Duration)
    func (d *DefaultMetricCollector) UpdateTotalDuration(timeSinceStart time.Duration)
type MetricCollector

Package files

default_metric_collector.go metric_collector.go

Variables

Registry is the default metricCollectorRegistry that circuits will use to collect statistics about the health of the circuit.

var Registry = metricCollectorRegistry{
    lock: &sync.RWMutex{},
    registry: []func(name string) MetricCollector{
        newDefaultMetricCollector,
    },
}

type DefaultMetricCollector

DefaultMetricCollector holds information about the circuit state. This implementation of MetricCollector is the canonical source of information about the circuit. It is used for for all internal hystrix operations including circuit health checks and metrics sent to the hystrix dashboard.

Metric Collectors do not need Mutexes as they are updated by circuits within a locked context.

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

func (*DefaultMetricCollector) Errors

func (d *DefaultMetricCollector) Errors() *rolling.Number

Errors returns the rolling number of errors

func (*DefaultMetricCollector) Failures

func (d *DefaultMetricCollector) Failures() *rolling.Number

Failures returns the rolling number of failures

func (*DefaultMetricCollector) FallbackFailures

func (d *DefaultMetricCollector) FallbackFailures() *rolling.Number

FallbackFailures returns the rolling number of fallback failures

func (*DefaultMetricCollector) FallbackSuccesses

func (d *DefaultMetricCollector) FallbackSuccesses() *rolling.Number

FallbackSuccesses returns the rolling number of fallback successes

func (*DefaultMetricCollector) IncrementAttempts

func (d *DefaultMetricCollector) IncrementAttempts()

IncrementAttempts increments the number of requests seen in the latest time bucket.

func (*DefaultMetricCollector) IncrementErrors

func (d *DefaultMetricCollector) IncrementErrors()

IncrementErrors increments the number of errors seen in the latest time bucket. Errors are any result from an attempt that is not a success.

func (*DefaultMetricCollector) IncrementFailures

func (d *DefaultMetricCollector) IncrementFailures()

IncrementFailures increments the number of failures seen in the latest time bucket.

func (*DefaultMetricCollector) IncrementFallbackFailures

func (d *DefaultMetricCollector) IncrementFallbackFailures()

IncrementFallbackFailures increments the number of failed calls to the fallback function in the latest time bucket.

func (*DefaultMetricCollector) IncrementFallbackSuccesses

func (d *DefaultMetricCollector) IncrementFallbackSuccesses()

IncrementFallbackSuccesses increments the number of successful calls to the fallback function in the latest time bucket.

func (*DefaultMetricCollector) IncrementRejects

func (d *DefaultMetricCollector) IncrementRejects()

IncrementRejects increments the number of rejected requests seen in the latest time bucket.

func (*DefaultMetricCollector) IncrementShortCircuits

func (d *DefaultMetricCollector) IncrementShortCircuits()

IncrementShortCircuits increments the number of rejected requests seen in the latest time bucket.

func (*DefaultMetricCollector) IncrementSuccesses

func (d *DefaultMetricCollector) IncrementSuccesses()

IncrementSuccesses increments the number of successes seen in the latest time bucket.

func (*DefaultMetricCollector) IncrementTimeouts

func (d *DefaultMetricCollector) IncrementTimeouts()

IncrementTimeouts increments the number of requests that timed out in the latest time bucket.

func (*DefaultMetricCollector) NumRequests

func (d *DefaultMetricCollector) NumRequests() *rolling.Number

NumRequests returns the rolling number of requests

func (*DefaultMetricCollector) Rejects

func (d *DefaultMetricCollector) Rejects() *rolling.Number

Rejects returns the rolling number of rejects

func (*DefaultMetricCollector) Reset

func (d *DefaultMetricCollector) Reset()

Reset resets all metrics in this collector to 0.

func (*DefaultMetricCollector) RunDuration

func (d *DefaultMetricCollector) RunDuration() *rolling.Timing

RunDuration returns the rolling run duration

func (*DefaultMetricCollector) ShortCircuits

func (d *DefaultMetricCollector) ShortCircuits() *rolling.Number

ShortCircuits returns the rolling number of short circuits

func (*DefaultMetricCollector) Successes

func (d *DefaultMetricCollector) Successes() *rolling.Number

Successes returns the rolling number of successes

func (*DefaultMetricCollector) Timeouts

func (d *DefaultMetricCollector) Timeouts() *rolling.Number

Timeouts returns the rolling number of timeouts

func (*DefaultMetricCollector) TotalDuration

func (d *DefaultMetricCollector) TotalDuration() *rolling.Timing

TotalDuration returns the rolling total duration

func (*DefaultMetricCollector) UpdateRunDuration

func (d *DefaultMetricCollector) UpdateRunDuration(runDuration time.Duration)

UpdateRunDuration updates the amount of time the latest request took to complete.

func (*DefaultMetricCollector) UpdateTotalDuration

func (d *DefaultMetricCollector) UpdateTotalDuration(timeSinceStart time.Duration)

UpdateTotalDuration updates the total amount of time this circuit has been running.

type MetricCollector

MetricCollector represents the contract that all collectors must fulfill to gather circuit statistics. Implementations of this interface do not have to maintain locking around thier data stores so long as they are not modified outside of the hystrix context.

type MetricCollector interface {
    // IncrementAttempts increments the number of updates.
    IncrementAttempts()
    // 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.
    IncrementErrors()
    // IncrementSuccesses increments the number of requests that succeed.
    IncrementSuccesses()
    // IncrementFailures increments the number of requests that fail.
    IncrementFailures()
    // IncrementRejects increments the number of requests that are rejected.
    IncrementRejects()
    // IncrementShortCircuits increments the number of requests that short circuited due to the circuit being open.
    IncrementShortCircuits()
    // IncrementTimeouts increments the number of timeouts that occurred in the circuit breaker.
    IncrementTimeouts()
    // IncrementFallbackSuccesses increments the number of successes that occurred during the execution of the fallback function.
    IncrementFallbackSuccesses()
    // IncrementFallbackFailures increments the number of failures that occurred during the execution of the fallback function.
    IncrementFallbackFailures()
    // UpdateTotalDuration updates the internal counter of how long we've run for.
    UpdateTotalDuration(timeSinceStart time.Duration)
    // UpdateRunDuration updates the internal counter of how long the last run took.
    UpdateRunDuration(runDuration time.Duration)
    // Reset resets the internal counters and timers.
    Reset()
}