ESB3024 Router counts the number of times a node and any of its children is selected in the routing table.
The visit counters can be retrieved with the following end points:
/v1/node_visits
Returns visit counters for each node as a flat list of host:counter
pairs in JSON.
Example output:
{
"node1": "1",
"node2": "1",
"node3": "1",
"top": "3"
}
/v1/node_visits_graph
Returns a full graph of nodes with their respective visit counters in GraphML.
Example output:
<?xml version="1.0"?>
<graphml xmlns="http://graphml.graphdrawing.org/xmlns"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://graphml.graphdrawing.org/xmlns
http://graphml.graphdrawing.org/xmlns/1.0/graphml.xsd">
<key id="visits" for="node" attr.name="visits" attr.type="string" />
<graph id="G" edgedefault="directed">
<node id="routing_table">
<data key="visits">5</data>
</node>
<node id="cdn1">
<data key="visits">1</data>
</node>
<node id="node1">
<data key="visits">1</data>
</node>
<node id="cdn2">
<data key="visits">2</data>
</node>
<node id="node2">
<data key="visits">2</data>
</node>
<node id="cdn3">
<data key="visits">2</data>
</node>
<node id="node3">
<data key="visits">2</data>
</node>
<edge id="e0" source="cdn1" target="node1" />
<edge id="e1" source="routing_table" target="cdn1" />
<edge id="e2" source="cdn2" target="node2" />
<edge id="e3" source="routing_table" target="cdn2" />
<edge id="e4" source="cdn3" target="node3" />
<edge id="e5" source="routing_table" target="cdn3" />
</graph>
</graphml>
To receive the graph as JSON, specify Accept:application/json
in the request headers.
Example output:
{
"edges": [
{
"source": "cdn1",
"target": "node1"
},
{
"source": "routing_table",
"target": "cdn1"
},
{
"source": "cdn2",
"target": "node2"
},
{
"source": "routing_table",
"target": "cdn2"
},
{
"source": "cdn3",
"target": "node3"
},
{
"source": "routing_table",
"target": "cdn3"
}
],
"nodes": [
{
"id": "routing_table",
"visits": "5"
},
{
"id": "cdn1",
"visits": "1"
},
{
"id": "node1",
"visits": "1"
},
{
"id": "cdn2",
"visits": "2"
},
{
"id": "node2",
"visits": "2"
},
{
"id": "cdn3",
"visits": "2"
},
{
"id": "node3",
"visits": "2"
}
]
}
A node visit counter with an id
not matching any node id
of a newly applied
routing table is destroyed.
Reset all counters to zero by momentarily applying a configuration with a
placeholder routing
root node, that has unique id
and an empty members
list, e.g:
"routing": {
"id": "empty_routing_table",
"members": []
}
… and immediately reapply the desired configuration.