How to use the @neo-one/monitor.metrics.createCounter function in @neo-one/monitor

To help you get started, we’ve selected a few @neo-one/monitor examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github neo-one-suite / neo-one / packages / neo-one-node-network / src / Network.js View on Github external
'ENETUNREACH',
  'SOCKET_TIMEOUT',
  'RECEIVE_MESSAGE_TIMEOUT',
  'EADDRNOTAVAIL',
  'ETIMEDOUT',
]);

const NEO_NETWORK_PEER_CLOSED_TOTAL = metrics.createCounter({
  name: 'neo_network_peer_closed_total',
  help:
    'Total number of times a peer was closed due to error or ending the socket.',
});
const NEO_NETWORK_PEER_CONNECT_TOTAL = metrics.createCounter({
  name: 'neo_network_peer_connect_total',
});
const NEO_NETWORK_PEER_CONNECT_FAILURES_TOTAL = metrics.createCounter({
  name: 'neo_network_peer_connect_failures_total',
});
const NEO_NETWORK_CONNECTED_PEERS_TOTAL = metrics.createGauge({
  name: 'neo_network_connected_peers_total',
});
const NEO_NETWORK_CONNECTING_PEERS_TOTAL = metrics.createGauge({
  name: 'neo_network_connecting_peers_total',
});

export default class Network {
  _monitor: Monitor;
  _started: boolean;
  _stopped: boolean;

  _externalEndpoints: Set;
  _maxConnectedPeers: number;
github neo-one-suite / neo-one / packages / neo-one-node-blockchain / src / Blockchain.js View on Github external
startHeight: number,
  endHeight: number,
  claimed: boolean,
|};

type Vote = {|
  publicKeys: Array,
  count: BN,
|};

const NAMESPACE = 'blockchain';

const NEO_BLOCKCHAIN_PERSIST_BLOCK_DURATION_SECONDS = metrics.createHistogram({
  name: 'neo_blockchain_persist_block_duration_seconds',
});
const NEO_BLOCKCHAIN_PERSIST_BLOCK_FAILURES_TOTAL = metrics.createCounter({
  name: 'neo_blockchain_persist_block_failures_total',
});
const NEO_BLOCKCHAIN_BLOCK_INDEX_GAUGE = metrics.createGauge({
  name: 'neo_blockchain_block_index',
  help: 'The current block index',
});
const NEO_BLOCKCHAIN_PERSISTING_BLOCK_INDEX_GAUGE = metrics.createGauge({
  name: 'neo_blockchain_persisting_block_index',
  help: 'The current in progress persist index',
});
const NEO_BLOCKCHAIN_PERSIST_BLOCK_LATENCY_SECONDS = metrics.createHistogram({
  name: 'neo_blockchain_persist_block_latency_seconds',
  help: 'The latency from block timestamp to persist',
  buckets: [1, 2, 5, 7.5, 10, 12.5, 15, 17.5, 20],
});
github neo-one-suite / neo-one / packages / neo-one-node-protocol / src / Node.js View on Github external
import Message, { type MessageValue, MessageTransform } from './Message';
import { AlreadyConnectedError, NegotiationError } from './errors';
import { type PeerData } from './PeerData';

import pkg from '../package.json';

const messageReceivedLabelNames = [labels.COMMAND_NAME];
const messageReceivedLabels = commonUtils.values(COMMAND).map((command) => ({
  [labels.COMMAND_NAME]: command,
}));
const NEO_PROTOCOL_MESSAGES_RECEIVED_TOTAL = metrics.createCounter({
  name: 'neo_protocol_messages_received_total',
  labelNames: messageReceivedLabelNames,
  labels: messageReceivedLabels,
});
const NEO_PROTOCOL_MESSAGES_FAILURES_TOTAL = metrics.createCounter({
  name: 'neo_protocol_messages_failures_total',
  labelNames: messageReceivedLabelNames,
  labels: messageReceivedLabels,
});
const NEO_PROTOCOL_MEMPOOL_SIZE = metrics.createGauge({
  name: 'neo_protocol_mempool_size',
});

export type Environment = {|
  network?: NetworkEnvironment,
|};
export type Options = {|
  consensus?: {|
    enabled: boolean,
    options: ConsensusOptions,
  |},
github neo-one-suite / neo-one / packages / neo-one-node-network / src / Network.js View on Github external
'ECONNREFUSED',
  'ERR_INVALID_IP_ADDRESS',
  'EHOSTUNREACH',
  'ENETUNREACH',
  'SOCKET_TIMEOUT',
  'RECEIVE_MESSAGE_TIMEOUT',
  'EADDRNOTAVAIL',
  'ETIMEDOUT',
]);

const NEO_NETWORK_PEER_CLOSED_TOTAL = metrics.createCounter({
  name: 'neo_network_peer_closed_total',
  help:
    'Total number of times a peer was closed due to error or ending the socket.',
});
const NEO_NETWORK_PEER_CONNECT_TOTAL = metrics.createCounter({
  name: 'neo_network_peer_connect_total',
});
const NEO_NETWORK_PEER_CONNECT_FAILURES_TOTAL = metrics.createCounter({
  name: 'neo_network_peer_connect_failures_total',
});
const NEO_NETWORK_CONNECTED_PEERS_TOTAL = metrics.createGauge({
  name: 'neo_network_connected_peers_total',
});
const NEO_NETWORK_CONNECTING_PEERS_TOTAL = metrics.createGauge({
  name: 'neo_network_connecting_peers_total',
});

export default class Network {
  _monitor: Monitor;
  _started: boolean;
  _stopped: boolean;
github neo-one-suite / neo-one / packages / neo-one-node-protocol / src / Node.js View on Github external
MerkleBlockPayload,
  NetworkAddress,
  VersionPayload,
} from './payload';
import { type ConsensusOptions, Consensus } from './consensus';
import Message, { type MessageValue, MessageTransform } from './Message';
import { AlreadyConnectedError, NegotiationError } from './errors';
import { type PeerData } from './PeerData';

import pkg from '../package.json';

const messageReceivedLabelNames = [labels.COMMAND_NAME];
const messageReceivedLabels = commonUtils.values(COMMAND).map((command) => ({
  [labels.COMMAND_NAME]: command,
}));
const NEO_PROTOCOL_MESSAGES_RECEIVED_TOTAL = metrics.createCounter({
  name: 'neo_protocol_messages_received_total',
  labelNames: messageReceivedLabelNames,
  labels: messageReceivedLabels,
});
const NEO_PROTOCOL_MESSAGES_FAILURES_TOTAL = metrics.createCounter({
  name: 'neo_protocol_messages_failures_total',
  labelNames: messageReceivedLabelNames,
  labels: messageReceivedLabels,
});
const NEO_PROTOCOL_MEMPOOL_SIZE = metrics.createGauge({
  name: 'neo_protocol_mempool_size',
});

export type Environment = {|
  network?: NetworkEnvironment,
|};
github neo-one-suite / neo-one / packages / neo-one-node-network / src / Network.js View on Github external
const EXTERNAL_ENDPOINTS = new Set();
const MAX_CONNECTED_PEERS = 10;
const CONNECT_PEERS_DELAY_MS = 5000;
const SOCKET_TIMEOUT_MS = 1000 * 60;
const CONNECT_ERROR_CODES = new Set([
  'ECONNREFUSED',
  'ERR_INVALID_IP_ADDRESS',
  'EHOSTUNREACH',
  'ENETUNREACH',
  'SOCKET_TIMEOUT',
  'RECEIVE_MESSAGE_TIMEOUT',
  'EADDRNOTAVAIL',
  'ETIMEDOUT',
]);

const NEO_NETWORK_PEER_CLOSED_TOTAL = metrics.createCounter({
  name: 'neo_network_peer_closed_total',
  help:
    'Total number of times a peer was closed due to error or ending the socket.',
});
const NEO_NETWORK_PEER_CONNECT_TOTAL = metrics.createCounter({
  name: 'neo_network_peer_connect_total',
});
const NEO_NETWORK_PEER_CONNECT_FAILURES_TOTAL = metrics.createCounter({
  name: 'neo_network_peer_connect_failures_total',
});
const NEO_NETWORK_CONNECTED_PEERS_TOTAL = metrics.createGauge({
  name: 'neo_network_connected_peers_total',
});
const NEO_NETWORK_CONNECTING_PEERS_TOTAL = metrics.createGauge({
  name: 'neo_network_connecting_peers_total',
});