Example #1
0
    def _init_gossip_stats(self, stat_domains):
        self.PacketStats = stats.Stats(self.LocalNode.Name, 'packet')
        self.PacketStats.add_metric(stats.Average('BytesSent'))
        self.PacketStats.add_metric(stats.Average('BytesReceived'))
        self.PacketStats.add_metric(stats.Counter('MessagesAcked'))
        self.PacketStats.add_metric(stats.Counter('DuplicatePackets'))
        self.PacketStats.add_metric(stats.Counter('DroppedPackets'))
        self.PacketStats.add_metric(stats.Counter('AcksReceived'))
        self.PacketStats.add_metric(stats.Counter('MessagesHandled'))
        self.PacketStats.add_metric(stats.Sample(
            'UnackedPacketCount', lambda: len(self.PendingAckMap)))

        self.MessageStats = stats.Stats(self.LocalNode.Name, 'message')
        self.MessageStats.add_metric(stats.MapCounter('MessageType'))
        if stat_domains is not None:
            stat_domains['packet'] = self.PacketStats
            stat_domains['message'] = self.MessageStats
Example #2
0
    def _initgossipstats(self):
        self.PacketStats = stats.Stats(self.LocalNode.Name, 'packet')
        self.PacketStats.add_metric(stats.Average('BytesSent'))
        self.PacketStats.add_metric(stats.Average('BytesReceived'))
        self.PacketStats.add_metric(stats.Counter('MessagesAcked'))
        self.PacketStats.add_metric(stats.Counter('DuplicatePackets'))
        self.PacketStats.add_metric(stats.Counter('DroppedPackets'))
        self.PacketStats.add_metric(stats.Counter('AcksReceived'))
        self.PacketStats.add_metric(stats.Counter('MessagesHandled'))
        self.PacketStats.add_metric(
            stats.Sample('UnackedPacketCount',
                         lambda: len(self.PendingAckMap)))

        self.MessageStats = stats.Stats(self.LocalNode.Name, 'message')
        self.MessageStats.add_metric(stats.MapCounter('MessageType'))

        self.StatDomains = {
            'packet': self.PacketStats,
            'message': self.MessageStats
        }
Example #3
0
    def _initledgerstats(self):
        self.JournalStats = stats.Stats(self.LocalNode.Name, 'ledger')
        self.JournalStats.add_metric(stats.Counter('CommitedBlockCount'))
        self.JournalStats.add_metric(stats.Counter('CommitedTxnCount'))
        self.JournalStats.add_metric(
            stats.Sample('PendingBlockCount', lambda: self.PendingBlockCount))
        self.JournalStats.add_metric(
            stats.Sample('PendingTxnCount', lambda: self.PendingTxnCount))

        self.StatDomains['ledger'] = self.JournalStats

        self.JournalConfigStats = stats.Stats(self.LocalNode.Name,
                                              'ledgerconfig')
        self.JournalConfigStats.add_metric(
            stats.Sample('MinimumTransactionsPerBlock',
                         lambda: self.MinimumTransactionsPerBlock))
        self.JournalConfigStats.add_metric(
            stats.Sample('MaximumTransactionsPerBlock',
                         lambda: self.MaximumTransactionsPerBlock))

        self.StatDomains['ledgerconfig'] = self.JournalConfigStats
Example #4
0
    def initialize_stats(self, localnode):
        """Initializes statistics collection for the node.

        Args:
            localnode (Node): the local node. Statistics are relative to
                the local node and the remote node.
        """
        self.Stats = stats.Stats(localnode.Name, self.Name)
        self.Stats.add_metric(stats.Value('Identifier', self.Identifier))
        self.Stats.add_metric(
            stats.Value('Address', "{0}:{1}".format(self.NetHost,
                                                    self.NetPort)))
        self.Stats.add_metric(
            stats.Sample('MessageQueue', lambda: str(self.MessageQ)))
        self.Stats.add_metric(
            stats.Sample('MessageQueueLength', lambda: self.MessageQ.Count))
        self.Stats.add_metric(
            stats.Sample('RoundTripEstimate', lambda: self.Estimator.RTO))