Remove debug logging (#119)

This commit is contained in:
Maciej Hirsz
2019-03-06 16:08:55 +01:00
committed by GitHub
parent bfd339bbe5
commit 1023b72fe7
9 changed files with 31 additions and 13 deletions
+6 -3
View File
@@ -26,6 +26,7 @@ export default class Node {
public readonly implementation: Types.NodeImplementation; public readonly implementation: Types.NodeImplementation;
public readonly version: Types.NodeVersion; public readonly version: Types.NodeVersion;
public readonly address: Maybe<Types.Address>; public readonly address: Maybe<Types.Address>;
public readonly networkId: Maybe<Types.NetworkId>;
public readonly authority: boolean; public readonly authority: boolean;
public readonly events = new EventEmitter() as EventEmitter & NodeEvents; public readonly events = new EventEmitter() as EventEmitter & NodeEvents;
@@ -64,6 +65,7 @@ export default class Node {
implentation: Types.NodeImplementation, implentation: Types.NodeImplementation,
version: Types.NodeVersion, version: Types.NodeVersion,
address: Maybe<Types.Address>, address: Maybe<Types.Address>,
networkId: Maybe<Types.NetworkId>,
authority: boolean, authority: boolean,
messages: Array<Message>, messages: Array<Message>,
) { ) {
@@ -76,6 +78,7 @@ export default class Node {
this.version = version; this.version = version;
this.address = address; this.address = address;
this.authority = authority; this.authority = authority;
this.networkId = networkId;
this.lastMessage = timestamp(); this.lastMessage = timestamp();
this.socket = socket; this.socket = socket;
@@ -143,9 +146,9 @@ export default class Node {
if (message.msg === "system.connected") { if (message.msg === "system.connected") {
cleanup(); cleanup();
const { name, chain, config, implementation, version, pubkey, authority } = message; const { name, chain, config, implementation, version, pubkey, authority, network_id: networkId } = message;
resolve(new Node(ip, socket, name, chain, config, implementation, version, pubkey, authority === true, messages)); resolve(new Node(ip, socket, name, chain, config, implementation, version, pubkey, networkId, authority === true, messages));
} else { } else {
if (messages.length === 10) { if (messages.length === 10) {
messages.shift(); messages.shift();
@@ -179,7 +182,7 @@ export default class Node {
public nodeDetails(): Types.NodeDetails { public nodeDetails(): Types.NodeDetails {
const authority = this.authority ? this.address : null; const authority = this.authority ? this.address : null;
return [this.name, this.implementation, this.version, authority]; return [this.name, this.implementation, this.version, authority, this.networkId];
} }
public nodeStats(): Types.NodeStats { public nodeStats(): Types.NodeStats {
+2 -2
View File
@@ -3,8 +3,8 @@ import Node from './Node';
import Feed from './Feed'; import Feed from './Feed';
import Aggregator from './Aggregator'; import Aggregator from './Aggregator';
const WS_PORT_TELEMETRY_SERVER = process.env.TELEMETRY_SERVER || 1024; const WS_PORT_TELEMETRY_SERVER = Number(process.env.TELEMETRY_SERVER || 1024);
const WS_PORT_FEED_SERVER = process.env.FEED_SERVER || 8080; const WS_PORT_FEED_SERVER = Number(process.env.FEED_SERVER || 8080);
const aggregator = new Aggregator(); const aggregator = new Aggregator();
+1
View File
@@ -48,6 +48,7 @@ export interface SystemConnected {
version: Types.NodeVersion; version: Types.NodeVersion;
pubkey: Maybe<Types.Address>; pubkey: Maybe<Types.Address>;
authority: Maybe<boolean>; authority: Maybe<boolean>;
network_id: Maybe<Types.NetworkId>;
} }
export interface SystemInterval extends BestBlock { export interface SystemInterval extends BestBlock {
+1 -1
View File
@@ -9,4 +9,4 @@ import * as FeedMessage from './feed';
export { Types, FeedMessage }; export { Types, FeedMessage };
// Increment this if breaking changes were made to types in `feed.ts` // Increment this if breaking changes were made to types in `feed.ts`
export const VERSION: Types.FeedVersion = 21 as Types.FeedVersion; export const VERSION: Types.FeedVersion = 22 as Types.FeedVersion;
+2 -1
View File
@@ -23,9 +23,10 @@ export type City = Opaque<string, 'City'>;
export type MemoryUse = Opaque<number, 'MemoryUse'>; export type MemoryUse = Opaque<number, 'MemoryUse'>;
export type CPUUse = Opaque<number, 'CPUUse'>; export type CPUUse = Opaque<number, 'CPUUse'>;
export type BytesPerSecond = Opaque<number, 'BytesPerSecond'>; export type BytesPerSecond = Opaque<number, 'BytesPerSecond'>;
export type NetworkId = Opaque<string, 'NetworkId'>;
export type BlockDetails = [BlockNumber, BlockHash, Milliseconds, Timestamp, Maybe<PropagationTime>]; export type BlockDetails = [BlockNumber, BlockHash, Milliseconds, Timestamp, Maybe<PropagationTime>];
export type NodeDetails = [NodeName, NodeImplementation, NodeVersion, Maybe<Address>]; export type NodeDetails = [NodeName, NodeImplementation, NodeVersion, Maybe<Address>, Maybe<NetworkId>];
export type NodeStats = [PeerCount, TransactionCount]; export type NodeStats = [PeerCount, TransactionCount];
export type NodeHardware = [Array<MemoryUse>, Array<CPUUse>, Array<BytesPerSecond>, Array<BytesPerSecond>, Array<Timestamp>]; export type NodeHardware = [Array<MemoryUse>, Array<CPUUse>, Array<BytesPerSecond>, Array<BytesPerSecond>, Array<Timestamp>];
export type NodeLocation = [Latitude, Longitude, City]; export type NodeLocation = [Latitude, Longitude, City];
+1
View File
@@ -22,6 +22,7 @@ export default class App extends React.Component<{}, State> {
validator: true, validator: true,
location: true, location: true,
implementation: true, implementation: true,
networkId: false,
peers: true, peers: true,
txs: true, txs: true,
cpu: true, cpu: true,
@@ -11,6 +11,7 @@ import nodeIcon from '../../icons/server.svg';
import nodeLocationIcon from '../../icons/location.svg'; import nodeLocationIcon from '../../icons/location.svg';
import nodeValidatorIcon from '../../icons/shield.svg'; import nodeValidatorIcon from '../../icons/shield.svg';
import nodeTypeIcon from '../../icons/terminal.svg'; import nodeTypeIcon from '../../icons/terminal.svg';
import networkIdIcon from '../../icons/fingerprint.svg';
import peersIcon from '../../icons/broadcast.svg'; import peersIcon from '../../icons/broadcast.svg';
import transactionsIcon from '../../icons/inbox.svg'; import transactionsIcon from '../../icons/inbox.svg';
import blockIcon from '../../icons/package.svg'; import blockIcon from '../../icons/package.svg';
@@ -150,6 +151,13 @@ export class Row extends React.Component<Row.Props, Row.State> {
); );
} }
}, },
{
label: 'Network ID',
icon: networkIdIcon,
width: 90,
setting: 'networkId',
render: ({ networkId }) => networkId ? <Truncate position="left" text={networkId} /> : '-'
},
{ {
label: 'Peer Count', label: 'Peer Count',
icon: peersIcon, icon: peersIcon,
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="m256 128c-44.1 0-80 35.9-80 80v256c0 8.8 7.2 16 16 16s16-7.2 16-16v-256c0-26.5 21.5-48 48-48 26.5 0 48 21.5 48 48 0 8.8 7.2 16 16 16s16-7.2 16-16c0-44.1-35.9-80-80-80z"/><path d="m256 192c-8.8 0-16 7.2-16 16v144c0 8.8 7.2 16 16 16s16-7.2 16-16v-144c0-8.8-7.2-16-16-16z"/><path d="m256 400c-8.8 0-16 7.2-16 16v80c0 8.8 7.2 16 16 16s16-7.2 16-16v-80c0-8.8-7.2-16-16-16z"/><path d="m320 256c-8.8 0-16 7.2-16 16v192c0 8.8 7.2 16 16 16s16-7.2 16-16v-192c0-8.8-7.2-16-16-16z"/><path d="m128 288c-8.8 0-16 7.2-16 16v112c0 8.8 7.2 16 16 16s16-7.2 16-16v-112c0-8.8-7.2-16-16-16z"/><path d="m448 256c-8.8 0-16 7.2-16 16v80c0 8.8 7.2 16 16 16s16-7.2 16-16v-80c0-8.8-7.2-16-16-16z"/><path d="m368.7 145.2c-8.2 3.3-12.1 12.6-8.8 20.8 5.4 13.3 8.1 27.4 8.1 42v208c0 8.8 7.2 16 16 16s16-7.2 16-16v-208c0-18.7-3.5-36.8-10.5-54-3.3-8.2-12.6-12.1-20.8-8.8z"/><path d="M256 64c-79.4 0-144 64.6-144 144v32c0 8.8 7.2 16 16 16s16-7.2 16-16v-32c0-61.8 50.2-112 112-112 25.8 0 50 8.5 70.1 24.6 6.9 5.5 17 4.4 22.5-2.5 5.5-6.9 4.4-17-2.5-22.5C320.7 75.2 288.7 64 256 64z"/><path d="m185.5 46.7c22.3-9.7 46-14.7 70.5-14.7 97 0 176 79 176 176 0 8.8 7.2 16 16 16s16-7.2 16-16c0-114.7-93.3-208-208-208-28.9 0-56.9 5.8-83.3 17.3-8.1 3.5-11.8 13-8.3 21.1 3.6 8.1 13 11.8 21.1 8.3z"/><path d="m123.6 68.1c-6.6-5.9-16.7-5.3-22.6 1.3-34.2 38.2-53 87.4-53 138.7v144c0 8.8 7.2 16 16 16s16-7.2 16-16v-144c0-43.4 15.9-85 44.8-117.3 5.9-6.6 5.3-16.7-1.2-22.6z"/></svg>

After

Width:  |  Height:  |  Size: 1.5 KiB

+4 -1
View File
@@ -23,6 +23,7 @@ export class Node {
public readonly implementation: Types.NodeImplementation; public readonly implementation: Types.NodeImplementation;
public readonly version: Types.NodeVersion; public readonly version: Types.NodeVersion;
public readonly validator: Maybe<Types.Address>; public readonly validator: Maybe<Types.Address>;
public readonly networkId: Maybe<Types.NetworkId>;
public pinned: boolean; public pinned: boolean;
public peers: Types.PeerCount; public peers: Types.PeerCount;
@@ -57,7 +58,7 @@ export class Node {
blockDetails: Types.BlockDetails, blockDetails: Types.BlockDetails,
location: Maybe<Types.NodeLocation> location: Maybe<Types.NodeLocation>
) { ) {
const [name, implementation, version, validator] = nodeDetails; const [name, implementation, version, validator, networkId] = nodeDetails;
this.pinned = pinned; this.pinned = pinned;
@@ -66,6 +67,7 @@ export class Node {
this.implementation = implementation; this.implementation = implementation;
this.version = version; this.version = version;
this.validator = validator; this.validator = validator;
this.networkId = networkId;
this.updateStats(nodeStats); this.updateStats(nodeStats);
this.updateHardware(nodeHardware); this.updateHardware(nodeHardware);
@@ -158,6 +160,7 @@ export namespace State {
location: boolean; location: boolean;
validator: boolean; validator: boolean;
implementation: boolean; implementation: boolean;
networkId: boolean;
peers: boolean; peers: boolean;
txs: boolean; txs: boolean;
cpu: boolean; cpu: boolean;