metrics
The metrics method returns a snapshot of the current Komodo DeFi Framework API metrics used in Prometheus and Grafana.
For more information check out the Komodo DeFi Framework metrics guide
Request Parameters
The metrics method does not take any additional parameters, and does not require authentication with your rpc_password.
Response Parameters
| Parameter | Type | Description |
|---|---|---|
| metrics | list of objects | There are a variety of metrics returned, with each metrics object havine a type, key, label, and some values which vary by type. |
Metrics object
| Parameter | Type | Description |
|---|---|---|
| type | string | A metric type which indicates how it should be displayed in visualisation. |
| key | string | A descriptive name assigned to the metric. |
| labels | object | Labels can be used to group similar metrics together or provide additional context. |
| value | float | Returned if type is gauge. A numeric value which indicates the magnitude of the metric being measured. |
| count | float | Returned if type is histogram. How many values were measured. |
| min | float | Returned if type is histogram. The smallest value measured. |
| max | float | Returned if type is histogram. The highest value measured. |
📌 Example(s)
Command
POST metrics
{
"method": "metrics",
"userpass": "RPC_UserP@SSW0RD"
} curl --url "http://127.0.0.1:7783" --data '{
"method": "metrics",
"userpass": "RPC_UserP@SSW0RD"
}' import requests
import json
url = "http://127.0.0.1:7783"
payload = {
"method": "metrics",
"userpass": "RPC_UserP@SSW0RD"
}
response = requests.post(url, json=payload)
print(json.dumps(response.json(), indent=2)) const payload = {
"method": "metrics",
"userpass": "RPC_UserP@SSW0RD"
};
const response = await fetch("http://127.0.0.1:7783", {
method: "POST",
body: JSON.stringify(payload),
});
console.log(await response.json()); <?php
$payload = <<<'JSON'
{
"method": "metrics",
"userpass": "RPC_UserP@SSW0RD"
}
JSON;
$ch = curl_init("http://127.0.0.1:7783");
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']);
$response = curl_exec($ch);
curl_close($ch);
echo $response; package main
import (
"bytes"
"fmt"
"io"
"net/http"
)
func main() {
payload := []byte(`{"method":"metrics","userpass":"RPC_UserP@SSW0RD"}`)
resp, err := http.Post("http://127.0.0.1:7783", "application/json", bytes.NewBuffer(payload))
if err != nil {
panic(err)
}
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
} require 'net/http'
require 'json'
require 'uri'
uri = URI("http://127.0.0.1:7783")
payload = {
"method": "metrics",
"userpass": "RPC_UserP@SSW0RD"
}
response = Net::HTTP.post(uri, payload.to_json, 'Content-Type' => 'application/json')
puts JSON.pretty_generate(JSON.parse(response.body)) Show Response
Response
{
"metrics": [
{
"type": "counter",
"key": "tx.history.response.count",
"labels": {
"coin": "MARTY",
"method": "tx_detail_by_hash"
},
"value": 25
},
{
"type": "counter",
"key": "rpc_client.request.count",
"labels": {
"client": "electrum",
"coin": "DOC"
},
"value": 1224
},
{
"type": "counter",
"key": "tx.history.response.count",
"labels": {
"method": "tx_detail_by_hash",
"coin": "DOC"
},
"value": 27
},
{
"type": "counter",
"key": "tx.history.request.count",
"labels": {
"coin": "DOC",
"method": "tx_detail_by_hash"
},
"value": 27
},
{
"type": "counter",
"key": "rpc_client.traffic.in",
"labels": {
"client": "electrum",
"coin": "DOC"
},
"value": 823841
},
{
"type": "counter",
"key": "rpc_client.traffic.out",
"labels": {
"coin": "MARTY",
"client": "electrum"
},
"value": 139396
},
{
"type": "counter",
"key": "tx.history.response.total_length",
"labels": {
"client": "electrum",
"coin": "MARTY",
"method": "blockchain.scripthash.get_history"
},
"value": 1041
},
{
"type": "counter",
"key": "tx.history.response.count",
"labels": {
"client": "electrum",
"coin": "MARTY",
"method": "blockchain.scripthash.get_history"
},
"value": 11
},
{
"type": "counter",
"key": "tx.history.response.count",
"labels": {
"method": "blockchain.scripthash.get_history",
"client": "electrum",
"coin": "DOC"
},
"value": 6
},
{
"type": "counter",
"key": "tx.history.request.count",
"labels": {
"coin": "MARTY",
"method": "tx_detail_by_hash"
},
"value": 25
},
{
"type": "counter",
"key": "rpc_client.response.count",
"labels": {
"coin": "DOC",
"client": "electrum"
},
"value": 1351
},
{
"type": "counter",
"key": "rpc_client.request.count",
"labels": {
"client": "electrum",
"coin": "MARTY"
},
"value": 1237
},
{
"type": "counter",
"key": "rpc_client.traffic.in",
"labels": {
"client": "electrum",
"coin": "MARTY"
},
"value": 772964
},
{
"type": "counter",
"key": "tx.history.response.total_length",
"labels": {
"coin": "DOC",
"client": "electrum",
"method": "blockchain.scripthash.get_history"
},
"value": 767
},
{
"type": "counter",
"key": "tx.history.request.count",
"labels": {
"coin": "DOC",
"client": "electrum",
"method": "blockchain.scripthash.get_history"
},
"value": 6
},
{
"type": "counter",
"key": "rpc_client.traffic.out",
"labels": {
"coin": "DOC",
"client": "electrum"
},
"value": 136368
},
{
"type": "counter",
"key": "tx.history.request.count",
"labels": {
"coin": "MARTY",
"client": "electrum",
"method": "blockchain.scripthash.get_history"
},
"value": 11
},
{
"type": "counter",
"key": "rpc_client.response.count",
"labels": {
"client": "electrum",
"coin": "MARTY"
},
"value": 1361
},
{
"type": "gauge",
"key": "p2p.connected_peers.count",
"labels": {},
"value": 8.0
},
{
"type": "gauge",
"key": "p2p.received_messages.count",
"labels": {},
"value": 24.0
},
{
"type": "gauge",
"key": "p2p.connected_relays.len",
"labels": {},
"value": 8.0
},
{
"type": "gauge",
"key": "p2p.relay_mesh.len",
"labels": {},
"value": 2.0
},
{
"type": "gauge",
"key": "orderbook.memory_db",
"labels": {},
"value": 297800390224.0
},
{
"type": "gauge",
"key": "orderbook.len",
"labels": {},
"value": 15.0
},
{
"type": "gauge",
"key": "p2p.received_messages.period_in_secs",
"labels": {},
"value": 60.0
},
{
"type": "histogram",
"key": "peer.outgoing_request.timing",
"labels": {
"peer": "12D3KooWJDoV9vJdy6PnzwVETZ3fWGMhV41VhSbocR1h2geFqq9Y"
},
"count": 2.0,
"max": 0.801318629,
"min": 0.699428848
}
]
}