tokio.analysis.umami module

Class and tools to generate TOKIO UMAMI plots

class tokio.analysis.umami.Umami(**kwds)[source]

Bases: collections.OrderedDict

Subclass of dictionary that stores all of the data needed to generate an UMAMI diagram. It is keyed by a metric name, and values are UmamiMetric objects which contain timestamps (x values) and measurements (y values)

_to_dict_for_pandas(stringify_key=False)[source]

Convert this object into a DataFrame, indexed by timestamp, with each column as a metric. The Umami attributes (labels, etc) are not expressed.

plot(output_file=None, highlight_index=-1, linewidth=1, linecolor='#853692', colorscale=['#DA0017', '#FD6A07', '#40A43A', '#2C69A9'], fontsize=12, figsize=(6.0, 1.3333333333333333))[source]

Create a graphical representation of the UMAMI object

Parameters:
  • output_file (str or None) – save umami diagram to file of given name
  • highlight_index (int) – index of measurement to highlight
  • linewidth (int) – linewidth for both timeseries and boxplot lines
  • linecolor (str) – color of line in timeseries panels
  • colorscale (list of str) – colors to use for data below the 25th, 50th, 75th, and 100th percentiles
  • fontsize (int) – font size for UMAMI labels
  • figsize (tuple of float) – x, y dimensions of a single UMAMI row; multiplied by len(self.keys()) to determine full diagram height
Returns:

List of matplotlib.axis.Axis objects corresponding to each panel in the UMAMI diagram

Return type:

list

to_dataframe()[source]

Return a representation of self as pandas.DataFrame

Returns:numerical representation of the values being plotted
Return type:pandas.DataFrame
to_dict()[source]

Convert this object (and all of its constituent UmamiMetric objects) into a dictionary

to_json()[source]

Serialize self into a JSON string

Returns:JSON representation of numerical data being plotted
Return type:str
class tokio.analysis.umami.UmamiMetric(timestamps, values, label, big_is_good=True)[source]

Bases: object

A single row of an UMAMI diagram.

Logically contains timeseries data from a single connector, where the timestamps attribute is a list of timestamps (seconds since epoch), and the ‘values’ attribute is a list of values corresponding to each timestamp. The number of timestamps and attributes must always be the same.

append(timestamp, value)[source]

Can only add values along with a timestamp.

pop()[source]

Analogous to the list .pop() method.

to_json()[source]

Create JSON-encoded string representation of self

Returns:JSON-encoded representation of values stored in UmamiMetric
Return type:str
tokio.analysis.umami._serialize_datetime(obj)[source]

Special serializer function that converts datetime into something that can be encoded in json