Metric lookup

The method Client.get_metrics() provides an interface for searching metrics available on the network. Depending on the arguments passed, a different search strategy is applied. If metadata=True, the result will be a dictionary mapping matching metrics to their metadata. Otherwise a plain list of matching metric names is returned. See the API documentation at get_metrics() for more details.

Search by regex

If the selector is a PCRE-style regex, all metrics whose name matches are returned:

>>> result = await client.get_metrics(
>>>     selector=r"elab\.ariel\..*", metadata=False, historic=True, limit=50
>>> )

>>> for metric in result:
>>>     print(metric)

elab.ariel.board.12V.power
elab.ariel.fan.power
elab.ariel.power
elab.ariel.s0.dram.power
elab.ariel.s0.package.power
elab.ariel.s0.package.power.chunk_offset
elab.ariel.s0.package.power.local_offset
elab.ariel.s1.dram.power
elab.ariel.s1.package.power
elab.ariel.sata.12V.power
elab.ariel.sata.5V.power
elab.ariel.sum.power

Alternatively, passing a list of metric names to selector matches exactly those metrics. This is useful if you know want to retrieve metadata for a metric you already know exists.

Search by prefix/infix

Call get_metrics() with prefix=... to search for metrics whose name starts with the given prefix:

>>> result = await client.get_metrics(prefix="ariel", metadata=False, limit=10)
>>>
>>> for metric in result:
>>>     print(metric)

elab.ariel.board.12V.power
elab.ariel.board.12V.power.100Hz
elab.ariel.board.12V.power.1Hz
elab.ariel.board.5V.power.1Hz
elab.ariel.fan.power
elab.ariel.fan.power.100Hz
elab.ariel.fan.power.1Hz
elab.ariel.fan.power.chunk_offset
elab.ariel.fan.power.local_offset
elab.ariel.fan.voltage

The name of a Metric is a string of .-separated components. Searching for infix="ariel" matches all metrics whose name contains the component ariel.

Note

Infix-matches work on components, so infix="ZZZ" will not match abc.dZZZe.fgh.

Warning

Infix lookup is not yet supported for non-historic metrics. You will always need to pass historic=True!

>>> result = await client.get_metrics(infix="ariel", metadata=False, historic=True, limit=50)
>>>
>>> for metric in result:
>>>     print(metric)

elab.ariel.board.12V.power
elab.ariel.fan.power
elab.ariel.power
elab.ariel.s0.dram.power
elab.ariel.s0.package.power
elab.ariel.s0.package.power.chunk_offset
elab.ariel.s0.package.power.local_offset
elab.ariel.s1.dram.power
elab.ariel.s1.package.power
elab.ariel.sata.12V.power
elab.ariel.sata.5V.power
elab.ariel.sum.power