hystrix.metrics module

Used by hystrix.command.Command to record metrics.

class hystrix.metrics.Metrics(counter)

Bases: object

Base class for metrics

Parameters:counter (hystrix.rolling_number.RollingNumber) – Used to increment or set values over time.
cumulative_count(event)

Cumulative count

Get the cumulative count since the start of the application for the given RollingNumberEvent.

Parameters:event (RollingNumberEvent) – The Event to retrieve a sum for.
Returns:Returns the long cumulative count.
Return type:long
rolling_count(event)

Rolling count

Get the rolling count for the given:class:RollingNumberEvent.

Parameters:event (RollingNumberEvent) – The Event to retrieve a sum for.
Returns:Returns the long cumulative count.
Return type:long
class hystrix.metrics.CommandMetricsMetaclass

Bases: type

Metaclass for CommandMetrics

Return a cached or create the CommandMetrics instance for a given hystrix.command.Command name.

This ensures only 1 CommandMetrics instance per hystrix.command.Command name.

class hystrix.metrics.CommandMetrics

Bases: hystrix.metrics.Metrics

Command metrics

class hystrix.metrics.ExecutorMetricsMetaclass

Bases: type

class hystrix.metrics.ExecutorMetrics

Bases: object

class hystrix.metrics.HealthCounts(total, error, error_percentage)

Bases: object

Number of requests during rolling window.

Number that failed (failure + success + timeout + thread pool rejected + short circuited + semaphore rejected).

Error percentage;

total_requests()

Total reqeust

Returns:Returns total request count.
Return type:int
error_count()

Error count

Returns:Returns error count.
Return type:int
error_percentage()

Error percentage

Returns:Returns error percentage.
Return type:int