-- -- --- --- --- --- --- --- ------- ------- ------- |
"""
-- -- --- --- --- --- --- --- ------- ------- ------- |
List available metrics across all providers.
-- -- --- --- --- --- --- --- ------- ------- ------- |
-- -- --- --- --- --- --- --- ------- ------- ------- |
TODO : Only show metrics for the operators that the cache has?
-- -- --- --- --- --- --- --- ------- ------- ------- |
"""
-- -- --- --- --- --- --- --- ------- ------- ------- |
import tabulate
-- -- --- --- --- --- --- --- ------- ------- ------- |
-- -- --- --- --- --- --- --- ------- ------- ------- |
from wily.helper import get_maxcolwidth, get_style
-- -- --- --- --- --- --- --- ------- ------- ------- |
from wily.operators import ALL_OPERATORS
-- -- --- --- --- --- --- --- ------- ------- ------- |
-- -- --- --- --- --- --- --- ------- ------- ------- |
-- 04 001 002 001 002 003 003 0004.75 0002.38 0000.50 |
def list_metrics(wrap: bool) -> None:
-- 04 001 002 001 002 003 003 0004.75 0002.38 0000.50 |
"""List metrics available."""
-- 04 001 002 001 002 003 003 0004.75 0002.38 0000.50 |
headers = ("Name", "Description", "Type", "Measure", "Aggregate")
-- 04 001 002 001 002 003 003 0004.75 0002.38 0000.50 |
maxcolwidth = get_maxcolwidth(headers, wrap)
-- 04 001 002 001 002 003 003 0004.75 0002.38 0000.50 |
style = get_style()
-- 04 001 002 001 002 003 003 0004.75 0002.38 0000.50 |
for name, operator in ALL_OPERATORS.items():
-- 04 001 002 001 002 003 003 0004.75 0002.38 0000.50 |
print(f"{name} operator:")
-- 04 001 002 001 002 003 003 0004.75 0002.38 0000.50 |
if len(operator.operator_cls.metrics) > 0:
-- 04 001 002 001 002 003 003 0004.75 0002.38 0000.50 |
print(
-- 04 001 002 001 002 003 003 0004.75 0002.38 0000.50 |
tabulate.tabulate(
-- 04 001 002 001 002 003 003 0004.75 0002.38 0000.50 |
headers=headers,
-- 04 001 002 001 002 003 003 0004.75 0002.38 0000.50 |
tabular_data=[
-- 04 001 002 001 002 003 003 0004.75 0002.38 0000.50 |
(m.name, m.description, m.metric_type, m.measure, m.aggregate)
-- 04 001 002 001 002 003 003 0004.75 0002.38 0000.50 |
for m in operator.operator_cls.metrics
-- 04 001 002 001 002 003 003 0004.75 0002.38 0000.50 |
],
-- 04 001 002 001 002 003 003 0004.75 0002.38 0000.50 |
tablefmt=style,
-- 04 001 002 001 002 003 003 0004.75 0002.38 0000.50 |
maxcolwidths=maxcolwidth,
-- 04 001 002 001 002 003 003 0004.75 0002.38 0000.50 |
maxheadercolwidths=maxcolwidth,
-- -- 001 002 001 002 003 003 0004.75 0002.38 0000.50 |
)
-- -- --- --- --- --- --- --- ------- ------- ------- |
)