Class: Evinrude::Metrics
- Inherits:
-
Object
- Object
- Evinrude::Metrics
- Defined in:
- lib/evinrude/metrics.rb
Instance Attribute Summary collapse
-
#command_execution ⇒ Object
readonly
Returns the value of attribute command_execution.
-
#commit_index ⇒ Object
readonly
Returns the value of attribute commit_index.
-
#info ⇒ Object
readonly
Returns the value of attribute info.
-
#joint_configuration ⇒ Object
readonly
Returns the value of attribute joint_configuration.
-
#log_entries_persisted ⇒ Object
readonly
Returns the value of attribute log_entries_persisted.
-
#log_file_size ⇒ Object
readonly
Returns the value of attribute log_file_size.
-
#log_loaded_from_disk ⇒ Object
readonly
Returns the value of attribute log_loaded_from_disk.
-
#match_index ⇒ Object
readonly
Returns the value of attribute match_index.
-
#messages_received ⇒ Object
readonly
Returns the value of attribute messages_received.
-
#next_index ⇒ Object
readonly
Returns the value of attribute next_index.
-
#node_count ⇒ Object
readonly
Returns the value of attribute node_count.
-
#read_state ⇒ Object
readonly
Returns the value of attribute read_state.
-
#remove_node ⇒ Object
readonly
Returns the value of attribute remove_node.
-
#replication_majority ⇒ Object
readonly
Returns the value of attribute replication_majority.
-
#rpc ⇒ Object
readonly
Returns the value of attribute rpc.
-
#rpc_exception ⇒ Object
readonly
Returns the value of attribute rpc_exception.
-
#snapshot_file_size ⇒ Object
readonly
Returns the value of attribute snapshot_file_size.
-
#start_time ⇒ Object
readonly
Returns the value of attribute start_time.
-
#state ⇒ Object
readonly
Returns the value of attribute state.
-
#term ⇒ Object
readonly
Returns the value of attribute term.
Instance Method Summary collapse
- #clear_peer_metrics ⇒ Object
-
#initialize(registry) ⇒ Metrics
constructor
A new instance of Metrics.
Constructor Details
#initialize(registry) ⇒ Metrics
Returns a new instance of Metrics.
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/evinrude/metrics.rb', line 13 def initialize(registry) @registry = registry @command_execution = Frankenstein::Request.new(:evinrude_command, description: "state machine command", registry: @registry) @commit_index = get_or_create(:gauge, :evinrude_commit_index, docstring: "The index of the last log entry committed to the state machine") @info = get_or_create(:gauge, :evinrude_node_info, docstring: "Basic information about this Evinrude node in labels", labels: i{node_name listen_address listen_port advertise_address advertise_port}) @joint_configuration = get_or_create(:gauge, :evinrude_joint_configuration_action, docstring: "Whether or not this node is currently using a 'joint' configuration for consensus") @log_entries_persisted = get_or_create(:counter, :evinrude_log_entries_persisted_total, docstring: "How many log entries have been persisted to disk") @log_file_size = get_or_create(:gauge, :evinrude_log_file_size_bytes, docstring: "The current size of the append-only log file") @log_loaded_from_disk = get_or_create(:gauge, :evinrude_log_loaded_from_disk, docstring: "Whether (1) or not (0) this Evinrude node was initialized from data on disk") @match_index = get_or_create(:gauge, :evinrude_follower_match_index, docstring: "The last log index known to be replicated to this follower", labels: i{peer node_name}) = get_or_create(:counter, :evinrude_messages_received_total, docstring: "How many unsolicited (RPC) messages have been received", labels: i{type}) @next_index = get_or_create(:gauge, :evinrude_follower_next_index, docstring: "The index of the next log entry to be sent to a follower node", labels: i{peer node_name}) @node_count = get_or_create(:gauge, :evinrude_node_count, docstring: "How many distinct nodes, active or otherwise, are currently in the cluster configuration") @read_state = Frankenstein::Request.new(:evinrude_read_state, description: "read state check", registry: @registry) @remove_node = Frankenstein::Request.new(:evinrude_remove_node, description: "remove node request", registry: @registry) @replication_majority = get_or_create(:gauge, :evinrude_replication_majority_index, docstring: "The last log index that has been replicated to a majority of nodes") @rpc = Frankenstein::Request.new(:evinrude_rpc, description: "remote procedure call", registry: @registry, labels: i{target}, duration_labels: i{target result}) @rpc_exception = get_or_create(:counter, :evinrude_rpc_to_leader_exceptions_total, docstring: "How many exceptions have been raised whilst trying to do RPCs to the cluster leader", labels: i{node_name target class}) @snapshot_file_size = get_or_create(:gauge, :evinrude_snapshot_file_size_bytes, docstring: "The current size of the snapshot data file") @start_time = get_or_create(:gauge, :evinrude_node_start_time, docstring: "The number of seconds since the Unix epoch at which this Evinrude node commenced operation") @state = get_or_create(:gauge, :evinrude_node_state, docstring: "The current state of the node; 0=init, 1=candidate, 2=follower, 3=leader") @term = get_or_create(:gauge, :evinrude_current_term, docstring: "The current Raft election 'term' that this node is operating in") end |
Instance Attribute Details
#command_execution ⇒ Object (readonly)
Returns the value of attribute command_execution.
7 8 9 |
# File 'lib/evinrude/metrics.rb', line 7 def command_execution @command_execution end |
#commit_index ⇒ Object (readonly)
Returns the value of attribute commit_index.
7 8 9 |
# File 'lib/evinrude/metrics.rb', line 7 def commit_index @commit_index end |
#info ⇒ Object (readonly)
Returns the value of attribute info.
7 8 9 |
# File 'lib/evinrude/metrics.rb', line 7 def info @info end |
#joint_configuration ⇒ Object (readonly)
Returns the value of attribute joint_configuration.
7 8 9 |
# File 'lib/evinrude/metrics.rb', line 7 def joint_configuration @joint_configuration end |
#log_entries_persisted ⇒ Object (readonly)
Returns the value of attribute log_entries_persisted.
7 8 9 |
# File 'lib/evinrude/metrics.rb', line 7 def log_entries_persisted @log_entries_persisted end |
#log_file_size ⇒ Object (readonly)
Returns the value of attribute log_file_size.
7 8 9 |
# File 'lib/evinrude/metrics.rb', line 7 def log_file_size @log_file_size end |
#log_loaded_from_disk ⇒ Object (readonly)
Returns the value of attribute log_loaded_from_disk.
7 8 9 |
# File 'lib/evinrude/metrics.rb', line 7 def log_loaded_from_disk @log_loaded_from_disk end |
#match_index ⇒ Object (readonly)
Returns the value of attribute match_index.
7 8 9 |
# File 'lib/evinrude/metrics.rb', line 7 def match_index @match_index end |
#messages_received ⇒ Object (readonly)
Returns the value of attribute messages_received.
7 8 9 |
# File 'lib/evinrude/metrics.rb', line 7 def end |
#next_index ⇒ Object (readonly)
Returns the value of attribute next_index.
7 8 9 |
# File 'lib/evinrude/metrics.rb', line 7 def next_index @next_index end |
#node_count ⇒ Object (readonly)
Returns the value of attribute node_count.
7 8 9 |
# File 'lib/evinrude/metrics.rb', line 7 def node_count @node_count end |
#read_state ⇒ Object (readonly)
Returns the value of attribute read_state.
7 8 9 |
# File 'lib/evinrude/metrics.rb', line 7 def read_state @read_state end |
#remove_node ⇒ Object (readonly)
Returns the value of attribute remove_node.
7 8 9 |
# File 'lib/evinrude/metrics.rb', line 7 def remove_node @remove_node end |
#replication_majority ⇒ Object (readonly)
Returns the value of attribute replication_majority.
7 8 9 |
# File 'lib/evinrude/metrics.rb', line 7 def replication_majority @replication_majority end |
#rpc ⇒ Object (readonly)
Returns the value of attribute rpc.
7 8 9 |
# File 'lib/evinrude/metrics.rb', line 7 def rpc @rpc end |
#rpc_exception ⇒ Object (readonly)
Returns the value of attribute rpc_exception.
7 8 9 |
# File 'lib/evinrude/metrics.rb', line 7 def rpc_exception @rpc_exception end |
#snapshot_file_size ⇒ Object (readonly)
Returns the value of attribute snapshot_file_size.
7 8 9 |
# File 'lib/evinrude/metrics.rb', line 7 def snapshot_file_size @snapshot_file_size end |
#start_time ⇒ Object (readonly)
Returns the value of attribute start_time.
7 8 9 |
# File 'lib/evinrude/metrics.rb', line 7 def start_time @start_time end |
#state ⇒ Object (readonly)
Returns the value of attribute state.
7 8 9 |
# File 'lib/evinrude/metrics.rb', line 7 def state @state end |
#term ⇒ Object (readonly)
Returns the value of attribute term.
7 8 9 |
# File 'lib/evinrude/metrics.rb', line 7 def term @term end |
Instance Method Details
#clear_peer_metrics ⇒ Object
38 39 40 41 42 |
# File 'lib/evinrude/metrics.rb', line 38 def clear_peer_metrics [@match_index, @next_index, @replication_majority].each do |metric| metric.values.keys.each { |ls| metric.remove(ls) } end end |