Pandas History Client

class metricq.pandas.PandasHistoryClient(*args, **kwargs)

This can be used similarly to a metricq.HistoryClient, but the data methods return pandas structures.

Note

Consider this class experimental, the type signatures may change at any time.

await connect()

Connect to the MetricQ network. You can either use this method, or use the class as an async context manager.

Return type:

None

await stop()

Stop the client and disconnect from the MetricQ network. Do not call this if you use the class as an async context manager.

Return type:

None

property client: HistoryClient

Access the underlying metricq.HistoryClient instance.

await get_metrics(*args, **kwargs)

The method works like metricq.Client.get_metrics(), but sets historic=True by default. See documentation there for a detailed description of the remaining arguments.

Return type:

dict[str, dict[str, Any]]

await history_aggregate_timeline(*args, **kwargs)

The method works like metricq.HistoryClient.history_aggregate_timeline(), but returns a pandas.DataFrame. The dataframe will have the following columns: :rtype: DataFrame

  • timestamp

  • minimum

  • maximum

  • sum

  • count

  • integral_ns

  • active_time

  • mean

  • mean_integral

  • mean_sum

  • integral_s

For details of those, see the documentation of metricq.TimeAggregate.

await history_raw_timeline(*args, **kwargs)

The method works like metricq.HistoryClient.history_raw_timeline(), but returns a pandas.DataFrame instead of a list of metricq.TimeValue objects. The dataframe will have the following columns: :rtype: DataFrame

  • timestamp

  • value