package metrics
- Alphabetic
- Public
- Protected
Type Members
- final case class AdaptiveLoadBalancingGroup(metricsSelector: MetricsSelector = MixMetricsSelector, paths: Iterable[String] = Nil, routerDispatcher: String = Dispatchers.DefaultDispatcherId) extends Group with Product with Serializable
A router group that performs load balancing of messages to cluster nodes based on cluster metric data.
A router group that performs load balancing of messages to cluster nodes based on cluster metric data.
It uses random selection of routees based on probabilities derived from the remaining capacity of corresponding node.
The configuration parameter trumps the constructor arguments. This means that if you provide
paths
during instantiation they will be ignored if the router is defined in the configuration file for the actor being used.- metricsSelector
decides what probability to use for selecting a routee, based on remaining capacity as indicated by the node metrics
- paths
string representation of the actor paths of the routees, messages are sent with akka.actor.ActorSelection to these paths
- routerDispatcher
dispatcher to use for the router head actor, which handles router management messages
- Annotations
- @SerialVersionUID()
- final case class AdaptiveLoadBalancingPool(metricsSelector: MetricsSelector = MixMetricsSelector, nrOfInstances: Int = 0, supervisorStrategy: SupervisorStrategy = Pool.defaultSupervisorStrategy, routerDispatcher: String = Dispatchers.DefaultDispatcherId, usePoolDispatcher: Boolean = false) extends Pool with Product with Serializable
A router pool that performs load balancing of messages to cluster nodes based on cluster metric data.
A router pool that performs load balancing of messages to cluster nodes based on cluster metric data.
It uses random selection of routees based on probabilities derived from the remaining capacity of corresponding node.
The configuration parameter trumps the constructor arguments. This means that if you provide
nrOfInstances
during instantiation they will be ignored if the router is defined in the configuration file for the actor being used.Supervision Setup
Any routees that are created by a router will be created as the router's children. The router is therefore also the children's supervisor.
The supervision strategy of the router actor can be configured with #withSupervisorStrategy. If no strategy is provided, routers default to a strategy of “always escalate”. This means that errors are passed up to the router's supervisor for handling.
The router's supervisor will treat the error as an error with the router itself. Therefore a directive to stop or restart will cause the router itself to stop or restart. The router, in turn, will cause its children to stop and restart.
- metricsSelector
decides what probability to use for selecting a routee, based on remaining capacity as indicated by the node metrics
- nrOfInstances
initial number of routees in the pool
- supervisorStrategy
strategy for supervising the routees, see 'Supervision Setup'
- routerDispatcher
dispatcher to use for the router head actor, which handles supervision, death watch and router management messages
- Annotations
- @SerialVersionUID()
- final case class AdaptiveLoadBalancingRoutingLogic(system: ActorSystem, metricsSelector: MetricsSelector = MixMetricsSelector) extends RoutingLogic with NoSerializationVerificationNeeded with Product with Serializable
Load balancing of messages to cluster nodes based on cluster metric data.
Load balancing of messages to cluster nodes based on cluster metric data.
It uses random selection of routees based on probabilities derived from the remaining capacity of corresponding node.
- system
the actor system hosting this router
- metricsSelector
decides what probability to use for selecting a routee, based on remaining capacity as indicated by the node metrics
- abstract class CapacityMetricsSelector extends MetricsSelector
A MetricsSelector producing weights from remaining capacity.
A MetricsSelector producing weights from remaining capacity. The weights are typically proportional to the remaining capacity.
- Annotations
- @nowarn() @SerialVersionUID()
- final case class ClusterMetricsChanged(nodeMetrics: Set[NodeMetrics]) extends ClusterMetricsEvent with Product with Serializable
Current snapshot of cluster node metrics.
- trait ClusterMetricsEvent extends AnyRef
Local cluster metrics extension events.
Local cluster metrics extension events.
Published to local event bus subscribers by ClusterMetricsCollector.
- class ClusterMetricsExtension extends Extension
Cluster metrics extension.
Cluster metrics extension.
Cluster metrics is primarily for load-balancing of nodes. It controls metrics sampling at a regular frequency, prepares highly variable data for further analysis by other entities, and publishes the latest cluster metrics data around the node ring and local eventStream to assist in determining the need to redirect traffic to the least-loaded nodes.
Metrics sampling is delegated to the MetricsCollector.
Smoothing of the data for each monitored process is delegated to the EWMA for exponential weighted moving average.
- case class ClusterMetricsSettings(config: Config) extends Product with Serializable
Metrics extension settings.
Metrics extension settings. Documented in:
src/main/resources/reference.conf
. - class ClusterMetricsStrategy extends OneForOneStrategy
Default ClusterMetricsSupervisor strategy: A configurable akka.actor.OneForOneStrategy with restart-on-throwable decider.
- sealed abstract class CollectionControlMessage extends Serializable
Runtime collection management commands.
- case class DefaultSigarProvider(settings: ClusterMetricsSettings) extends SigarProvider with Product with Serializable
Provide sigar instance as
SigarProxy
with configured location via ClusterMetricsSettings. - final case class EWMA(value: Double, alpha: Double) extends Product with Serializable
The exponentially weighted moving average (EWMA) approach captures short-term movements in volatility for a conditional volatility forecasting model.
The exponentially weighted moving average (EWMA) approach captures short-term movements in volatility for a conditional volatility forecasting model. By virtue of its alpha, or decay factor, this provides a statistical streaming data model that is exponentially biased towards newer entries.
https://en.wikipedia.org/wiki/Moving_average#Exponential_moving_average
An EWMA only needs the most recent forecast value to be kept, as opposed to a standard moving average model.
- value
the current exponentially weighted moving average, e.g. Y(n - 1), or, the sampled value resulting from the previous smoothing iteration. This value is always used as the previous EWMA to calculate the new EWMA.
- alpha
decay factor, sets how quickly the exponential weighting decays for past data compared to new data, see https://en.wikipedia.org/wiki/Moving_average#Exponential_moving_average
- Annotations
- @SerialVersionUID()
- class JmxMetricsCollector extends MetricsCollector
Loads JVM and system metrics through JMX monitoring beans.
- final case class Metric extends MetricNumericConverter with Product with Serializable
Metrics key/value.
Metrics key/value.
Equality of Metric is based on its name.
- Annotations
- @SerialVersionUID()
- trait MetricsCollector extends Closeable
Metrics sampler.
Metrics sampler.
Implementations of cluster system metrics collectors extend this trait.
- trait MetricsSelector extends Serializable
A MetricsSelector is responsible for producing weights from the node metrics.
A MetricsSelector is responsible for producing weights from the node metrics.
- Annotations
- @nowarn() @SerialVersionUID()
- final case class MixMetricsSelector(selectors: IndexedSeq[CapacityMetricsSelector]) extends MixMetricsSelectorBase with Product with Serializable
MetricsSelector that combines other selectors and aggregates their capacity values.
MetricsSelector that combines other selectors and aggregates their capacity values. By default it uses [akka.cluster.routing.HeapMetricsSelector], [akka.cluster.routing.CpuMetricsSelector], and [akka.cluster.routing.SystemLoadAverageMetricsSelector]
- Annotations
- @SerialVersionUID()
- abstract class MixMetricsSelectorBase extends CapacityMetricsSelector
Base class for MetricsSelector that combines other selectors and aggregates their capacity.
Base class for MetricsSelector that combines other selectors and aggregates their capacity.
- Annotations
- @SerialVersionUID()
- final case class NodeMetrics(address: Address, timestamp: Long, metrics: Set[Metric] = Set.empty[Metric]) extends Product with Serializable
The snapshot of current sampled health metrics for any monitored process.
The snapshot of current sampled health metrics for any monitored process. Collected and gossipped at regular intervals for dynamic cluster management strategies.
Equality of NodeMetrics is based on its address.
- address
akka.actor.Address of the node the metrics are gathered at
- timestamp
the time of sampling, in milliseconds since midnight, January 1, 1970 UTC
- metrics
the set of sampled akka.cluster.metrics.Metric
- Annotations
- @SerialVersionUID()
- class SigarMetricsCollector extends JmxMetricsCollector
Loads metrics through Hyperic SIGAR and JMX monitoring beans.
Loads metrics through Hyperic SIGAR and JMX monitoring beans. This loads wider and more accurate range of metrics compared to JmxMetricsCollector by using SIGAR's native OS library.
The constructor will by design throw exception if org.hyperic.sigar.Sigar can't be loaded, due to missing classes or native libraries.
- trait SigarProvider extends AnyRef
Provide sigar instance as
SigarProxy
.Provide sigar instance as
SigarProxy
.User can provision sigar classes and native library in one of the following ways:
1) Use Kamon sigar-loader as a project dependency for the user project. Metrics extension will extract and load sigar library on demand with help of Kamon sigar provisioner.
2) Use Kamon sigar-loader as java agent:
java -javaagent:/path/to/sigar-loader.jar
Kamon sigar loader agent will extract and load sigar library during JVM start.3) Place
sigar.jar
on theclasspath
and sigar native library for the o/s on thejava.library.path
User is required to manage both project dependency and library deployment manually.
Value Members
- object ClusterMetricsExtension extends ExtensionId[ClusterMetricsExtension] with ExtensionIdProvider
Cluster metrics extension provider.
- object ClusterMetricsStrategy extends Serializable
Provide custom metrics strategy resources.
- case object CollectionStartMessage extends CollectionControlMessage with Product with Serializable
Command for ClusterMetricsSupervisor to start metrics collection.
Command for ClusterMetricsSupervisor to start metrics collection.
- Annotations
- @SerialVersionUID()
- case object CollectionStopMessage extends CollectionControlMessage with Product with Serializable
Command for ClusterMetricsSupervisor to stop metrics collection.
Command for ClusterMetricsSupervisor to stop metrics collection.
- Annotations
- @SerialVersionUID()
- case object CpuMetricsSelector extends CapacityMetricsSelector with Product with Serializable
MetricsSelector that uses the combined CPU time metrics and stolen CPU time metrics.
MetricsSelector that uses the combined CPU time metrics and stolen CPU time metrics. In modern Linux kernels: CpuCombined + CpuStolen + CpuIdle = 1.0 or 100%. Combined CPU is sum of User + Sys + Nice + Wait times, as percentage. Stolen CPU is the amount of CPU taken away from this virtual machine by the hypervisor, as percentage.
Low CPU capacity => small node weight.
- Annotations
- @SerialVersionUID()
- object EWMA extends Serializable
- case object HeapMetricsSelector extends CapacityMetricsSelector with Product with Serializable
MetricsSelector that uses the heap metrics.
MetricsSelector that uses the heap metrics. Low heap capacity => small weight.
- Annotations
- @SerialVersionUID()
- object Metric extends MetricNumericConverter with Serializable
Factory for creating valid Metric instances.
- object MetricsSelector extends Serializable
- object MixMetricsSelector extends MixMetricsSelectorBase
Singleton instance of the default MixMetricsSelector, which uses [akka.cluster.routing.HeapMetricsSelector], [akka.cluster.routing.CpuMetricsSelector], and [akka.cluster.routing.SystemLoadAverageMetricsSelector]
Singleton instance of the default MixMetricsSelector, which uses [akka.cluster.routing.HeapMetricsSelector], [akka.cluster.routing.CpuMetricsSelector], and [akka.cluster.routing.SystemLoadAverageMetricsSelector]
- Annotations
- @SerialVersionUID()
- object SigarProvider
- object StandardMetrics
Definitions of the built-in standard metrics.
Definitions of the built-in standard metrics.
The following extractors and data structures makes it easy to consume the NodeMetrics in for example load balancers.
- case object SystemLoadAverageMetricsSelector extends CapacityMetricsSelector with Product with Serializable
MetricsSelector that uses the system load average metrics.
MetricsSelector that uses the system load average metrics. System load average is OS-specific average load on the CPUs in the system, for the past 1 minute. The system is possibly nearing a bottleneck if the system load average is nearing number of cpus/cores. Low load average capacity => small weight.
- Annotations
- @SerialVersionUID()