/ node / metrics / src / names.rs
names.rs
  1  // Copyright (c) 2025 ADnet Contributors
  2  // This file is part of the AlphaOS library.
  3  
  4  // Licensed under the Apache License, Version 2.0 (the "License");
  5  // you may not use this file except in compliance with the License.
  6  // You may obtain a copy of the License at:
  7  
  8  // http://www.apache.org/licenses/LICENSE-2.0
  9  
 10  // Unless required by applicable law or agreed to in writing, software
 11  // distributed under the License is distributed on an "AS IS" BASIS,
 12  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 13  // See the License for the specific language governing permissions and
 14  // limitations under the License.
 15  
 16  pub(super) const COUNTER_NAMES: [&str; 3] =
 17      [bft::LEADERS_ELECTED, consensus::STALE_UNCONFIRMED_TRANSACTIONS, consensus::STALE_UNCONFIRMED_SOLUTIONS];
 18  
 19  pub(super) const GAUGE_NAMES: [&str; 27] = [
 20      bft::CONNECTED,
 21      bft::CONNECTED_STAKE,
 22      bft::CONNECTING,
 23      bft::LAST_STORED_ROUND,
 24      bft::PROPOSAL_ROUND,
 25      bft::CERTIFIED_BATCHES,
 26      bft::HEIGHT,
 27      bft::LAST_COMMITTED_ROUND,
 28      bft::IS_SYNCED,
 29      blocks::SOLUTIONS,
 30      blocks::TRANSACTIONS,
 31      blocks::ACCEPTED_DEPLOY,
 32      blocks::ACCEPTED_EXECUTE,
 33      blocks::REJECTED_DEPLOY,
 34      blocks::REJECTED_EXECUTE,
 35      blocks::ABORTED_TRANSACTIONS,
 36      blocks::ABORTED_SOLUTIONS,
 37      blocks::PROOF_TARGET,
 38      blocks::COINBASE_TARGET,
 39      blocks::CUMULATIVE_PROOF_TARGET,
 40      consensus::COMMITTED_CERTIFICATES,
 41      consensus::UNCONFIRMED_SOLUTIONS,
 42      consensus::UNCONFIRMED_TRANSACTIONS,
 43      router::CONNECTED,
 44      router::CANDIDATE,
 45      router::RESTRICTED,
 46      tcp::TCP_TASKS,
 47  ];
 48  
 49  pub(super) const HISTOGRAM_NAMES: [&str; 4] =
 50      [bft::COMMIT_ROUNDS_LATENCY, consensus::CERTIFICATE_COMMIT_LATENCY, consensus::BLOCK_LATENCY, consensus::BLOCK_LAG];
 51  
 52  pub mod bft {
 53      pub const COMMIT_ROUNDS_LATENCY: &str = "alphaos_bft_commit_rounds_latency_secs"; // <-- This one doesn't even make sense.
 54      pub const CONNECTED: &str = "alphaos_bft_connected_total";
 55      pub const CONNECTED_STAKE: &str = "alphaos_bft_connected_stake_as_percentage";
 56      pub const CONNECTING: &str = "alphaos_bft_connecting_total";
 57      pub const LAST_STORED_ROUND: &str = "alphaos_bft_last_stored_round";
 58      pub const LEADERS_ELECTED: &str = "alphaos_bft_leaders_elected_total";
 59      pub const PROPOSAL_ROUND: &str = "alphaos_bft_primary_proposal_round";
 60      pub const CERTIFIED_BATCHES: &str = "alphaos_bft_primary_certified_batches";
 61      pub const HEIGHT: &str = "alphaos_bft_height_total";
 62      pub const LAST_COMMITTED_ROUND: &str = "alphaos_bft_last_committed_round";
 63      pub const IS_SYNCED: &str = "alphaos_bft_is_synced";
 64  }
 65  
 66  pub mod blocks {
 67      pub const TRANSACTIONS: &str = "alphaos_blocks_transactions_total";
 68      pub const SOLUTIONS: &str = "alphaos_blocks_solutions_total";
 69      pub const ACCEPTED_DEPLOY: &str = "alphaos_blocks_accepted_deploy";
 70      pub const ACCEPTED_EXECUTE: &str = "alphaos_blocks_accepted_execute";
 71      pub const REJECTED_DEPLOY: &str = "alphaos_blocks_rejected_deploy";
 72      pub const REJECTED_EXECUTE: &str = "alphaos_blocks_rejected_execute";
 73      pub const ABORTED_TRANSACTIONS: &str = "alphaos_blocks_aborted_transactions";
 74      pub const ABORTED_SOLUTIONS: &str = "alphaos_blocks_aborted_solutions";
 75      pub const PROOF_TARGET: &str = "alphaos_blocks_proof_target";
 76      pub const COINBASE_TARGET: &str = "alphaos_blocks_coinbase_target";
 77      pub const CUMULATIVE_PROOF_TARGET: &str = "alphaos_blocks_cumulative_proof_target";
 78  }
 79  
 80  pub mod consensus {
 81      pub const CERTIFICATE_COMMIT_LATENCY: &str = "alphaos_consensus_certificate_commit_latency_secs";
 82      pub const COMMITTED_CERTIFICATES: &str = "alphaos_consensus_committed_certificates_total";
 83      pub const BLOCK_LATENCY: &str = "alphaos_consensus_block_latency_secs";
 84      pub const BLOCK_LAG: &str = "alphaos_consensus_block_lag_ms";
 85      pub const UNCONFIRMED_TRANSACTIONS: &str = "alphaos_consensus_unconfirmed_transactions_total";
 86      pub const UNCONFIRMED_SOLUTIONS: &str = "alphaos_consensus_unconfirmed_solutions_total";
 87      pub const TRANSMISSION_LATENCY: &str = "alphaos_consensus_transmission_latency";
 88      pub const STALE_UNCONFIRMED_TRANSACTIONS: &str = "alphaos_consensus_stale_unconfirmed_transactions";
 89      pub const STALE_UNCONFIRMED_SOLUTIONS: &str = "alphaos_consensus_stale_unconfirmed_solutions";
 90      pub const VALIDATOR_PARTICIPATION: &str = "alphaos_consensus_validator_participation";
 91  }
 92  
 93  pub mod router {
 94      pub const CONNECTED: &str = "alphaos_router_connected_total";
 95      pub const CANDIDATE: &str = "alphaos_router_candidate_total";
 96      pub const RESTRICTED: &str = "alphaos_router_restricted_total";
 97  }
 98  
 99  pub mod tcp {
100      pub const TCP_TASKS: &str = "alphaos_tcp_tasks_total";
101  }