Stats#

class defichain.node.Stats(node)#
getrpcstats(command: str) {}#

Get RPC stats for selected command

Parameters:

command (str) – (required) The command to get stats for

Returns:

{…} (json) – returns rpc stats

{
    "name":               (string) The RPC command name.
    "latency":            (json object) Min, max and average latency.
    "payload":            (json object) Min, max and average payload size in bytes.
    "count":              (numeric) The number of times this command as been used.
    "lastUsedTime":       (numeric) Last used time as timestamp.
    "history":            (json array) History of last 5 RPC calls.
    [
        {
        "timestamp": (numeric)
        "latency":   (numeric)
        "payload":   (numeric)
        }
    ]
}

Example:
>>> node.stats.getrpcstats("getblockcount")
listrpcstats() []#

List used RPC commands

Returns:

{…} (json) – returns a list of rpc stats

[
    {
        "name":               (string) The RPC command name.
        "latency":            (json object) Min, max and average latency.
        "payload":            (json object) Min, max and average payload size in bytes.
        "count":              (numeric) The number of times this command as been used.
        "lastUsedTime":       (numeric) Last used time as timestamp.
        "history":            (json array) History of last 5 RPC calls.
        [
            {
                "timestamp": (numeric)
                "latency":   (numeric)
                "payload":   (numeric)
            }
        ]
    }
]

Example:
>>> node.stats.listrpcstats()