aerospike_helpers.metrics package
Classes used for metrics.
ConnectionStats
, NodeMetrics
, Node
, and Cluster
do not have a constructor
because they are not meant to be created by the user. They are only meant to be returned from MetricsListeners
callbacks for reading data about the server and client.
- class aerospike_helpers.metrics.Cluster
Bases:
object
Cluster of server nodes.
- tran_count
Transaction count. The value is cumulative and not reset per metrics interval.
- Type:
- retry_count
Transaction retry count. There can be multiple retries for a single transaction. The value is cumulative and not reset per metrics interval.
- Type:
- __weakref__
list of weak references to the object
- class aerospike_helpers.metrics.ConnectionStats
Bases:
object
Connection statistics.
- in_use
Connections actively being used in database transactions on this node. There can be multiple pools per node. This value is a summary of those pools on this node.
- Type:
- in_pool
Connections residing in pool(s) on this node. There can be multiple pools per node. This value is a summary of those pools on this node.
- Type:
- __weakref__
list of weak references to the object
- class aerospike_helpers.metrics.MetricsListeners(enable_listener: Callable[[], None], snapshot_listener: Callable[[Cluster], None], node_close_listener: Callable[[Node], None], disable_listener: Callable[[Cluster], None])
Bases:
object
Metrics listener callbacks.
All callbacks must be set.
- enable_listener
Periodic extended metrics has been enabled for the given cluster.
- Type:
Callable[[], None]
- snapshot_listener
A metrics snapshot has been requested for the given cluster.
- Type:
Callable[[Cluster], None]
- disable_listener
Periodic extended metrics has been disabled for the given cluster.
- Type:
Callable[[Cluster], None]
- __init__(enable_listener: Callable[[], None], snapshot_listener: Callable[[Cluster], None], node_close_listener: Callable[[Node], None], disable_listener: Callable[[Cluster], None])
- __weakref__
list of weak references to the object
- class aerospike_helpers.metrics.MetricsPolicy(metrics_listeners: MetricsListeners | None = None, report_dir: str = '.', report_size_limit: int = 0, interval: int = 30, latency_columns: int = 7, latency_shift: int = 1)
Bases:
object
Client periodic metrics configuration.
- metrics_listeners
Listeners that handles metrics notification events. If set to
None
, the default listener implementation will be used, which writes the metrics snapshot to a file which can later be read and forwarded to OpenTelemetry by a separate offline application. Otherwise, use all listeners set in the class instance.The listener could be overridden to send the metrics snapshot directly to OpenTelemetry.
- Type:
Optional[
MetricsListeners
]
- report_size_limit
Metrics file size soft limit in bytes for listeners that write logs. When report_size_limit is reached or exceeded, the current metrics file is closed and a new metrics file is created with a new timestamp. If report_size_limit is zero, the metrics file size is unbounded and the file will only be closed when
disable_metrics()
orclose()
is called.- Type:
- interval
Number of cluster tend iterations between metrics notification events. One tend iteration is defined as
"tend_interval"
in the client config plus the time to tend all nodes.- Type:
- latency_shift
Power of 2 multiple between each range bucket in latency histograms starting at column 3. The bucket units are in milliseconds. The first 2 buckets are “<=1ms” and “>1ms”.
Example:
# latencyColumns=7 latencyShift=1 # <=1ms >1ms >2ms >4ms >8ms >16ms >32ms # latencyColumns=5 latencyShift=3 # <=1ms >1ms >8ms >64ms >512ms
- Type:
- __init__(metrics_listeners: MetricsListeners | None = None, report_dir: str = '.', report_size_limit: int = 0, interval: int = 30, latency_columns: int = 7, latency_shift: int = 1)
- __weakref__
list of weak references to the object
- class aerospike_helpers.metrics.Node
Bases:
object
Server node representation.
- conns
Synchronous connection stats on this node.
- Type:
- error_count
Transaction error count since node was initialized. If the error is retryable, multiple errors per transaction may occur.
- Type:
- timeout_count
Transaction timeout count since node was initialized. If the timeout is retryable (ie socketTimeout), multiple timeouts per transaction may occur.
- Type:
- metrics
Node metrics
- Type:
- __weakref__
list of weak references to the object