Support listing metrics by prefix and depth
Created by: davecromberge
Propose a rename the function from metric_variants
to metrics
, as there is symmetry to the existing metrics/1
function.
From the dalmatiner-frontend perspective, it may allow a more concise resource location eg:
http://localhost:8080/collections/7c/metrics/aW5mbHV4ZGIucHJvY2Vzc2Vz
The depth
argument allows the client to configure the depth for the search by prefix.
Example: depth 1, prefix <<"base">>
{ok,[[<<"count">>],
[<<"cpu">>],
[<<"ctx-switch">>],
...
[<<"swap">>],
[<<"uptime">>],
[<<"vmem">>]]}
Example: depth 3, prefix <<"base">>
{ok,[[<<"count">>],
[<<"cpu">>],
[<<"cpu">>,<<"0">>,<<"guest">>],
[<<"cpu">>,<<"0">>,<<"guest_nice">>],
[<<"cpu">>,<<"0">>,<<"idle">>],
[<<"cpu">>,<<"0">>,<<"iowait">>],
...
[<<"cpu">>,<<"1">>,<<"steal">>],
[<<"cpu">>,<<"1">>,<<"system">>],
[<<"cpu">>,<<"1">>,<<"user">>],
[<<"cpu">>,<<"10">>,<<"idle">>]]}
Note that results above are decoded from dproto metric encoding.