Example #1
0
        public void RegisterStatisticFeeds()
        {
            string byteFormatter((object?value, int widthHint) item) => ByteSizeFormatter.HumanReadable((long)item.value !);

            _statisticFeedsCollector.RegisterStatisticFeeds(this,
                                                            new StatisticFeedDefinition(FEED_CONNECTED_PEERS_SUMMARY, "Connected Peers summary",
                                                                                        new List <FieldDefinition> {
                new FieldDefinition("Inbound", "Number of inbound peers currently connected to one of the Forge listener", 15),
                new FieldDefinition("Outbound", "Number of outbound peers our forge is currently connected to", 15)
            },
                                                                                        TimeSpan.FromSeconds(15)
                                                                                        ),
                                                            new StatisticFeedDefinition(FEED_CONNECTED_PEERS, "Connected Peers",
                                                                                        new List <FieldDefinition> {
                new FieldDefinition("Endpoint", "Peer remote endpoint", 25),
                new FieldDefinition("Type", "Type of connection (inbound, outbound, etc..)", 10),
                new FieldDefinition("Version", "Negotiated protocol version", 8),
                new FieldDefinition("User Agent", "Peer User Agent", 20),
                new FieldDefinition("Received", "Bytes received from this peer", 10, null, byteFormatter),
                new FieldDefinition("Sent", "Bytes sent to this peer", 10, null, byteFormatter),
                new FieldDefinition("Wasted", "Bytes that we received but wasn't understood from our node", 10, null, byteFormatter),
            },
                                                                                        TimeSpan.FromSeconds(15)
                                                                                        )
                                                            );
        }
        public void RegisterStatisticFeeds()
        {
            _statisticFeedsCollector.RegisterStatisticFeeds(this,
                                                            new StatisticFeedDefinition(
                                                                FEED_PERIODIC_WORKS,
                                                                "Periodic Works",
                                                                new List <FieldDefinition> {
                new FieldDefinition(
                    "Id",
                    "Periodic work instance unique identifier",
                    36,
                    string.Empty
                    ),
                new FieldDefinition(
                    "Label",
                    "Label assigned to the periodic work instance",
                    55,
                    string.Empty
                    ),
                new FieldDefinition(
                    "Running",
                    "True if the work is running, false otherwise",
                    7,
                    string.Empty
                    ),
                new FieldDefinition(
                    "Exceptions",
                    "Number of exceptions generated since work started",
                    10,
                    string.Empty
                    ),
                new FieldDefinition(
                    "Last Exception",
                    "Last Exception message",
                    50,
                    string.Empty,
                    item => {
                    int maxLen     = item.widthHint;
                    string message = (item.value as Exception)?.Message ?? string.Empty;

                    return(message.Length >= maxLen ? $"{message.Substring(0, maxLen-3)}...": message);
                }),
            },
                                                                TimeSpan.FromSeconds(15)
                                                                )
                                                            );
        }