# Metrics and checks¶

Note

There are two main parts related to handling of metrics and checks in Dataiku’s Python APIs:

Both classes have fairly similar capabilities

For more details on the two packages, please see Python APIs

## dataiku package API¶

class dataiku.ComputedMetrics(raw)

Handle to the metrics of a DSS object and their last computed value

get_metric_by_id(metric_id)

Retrive the info for a given metric

Parameters: metric_id – unique identifier of the metric
get_global_data(metric_id)

Get the global value point of a given metric, or throws.

For a partitioned dataset, the global value is the value of the metric computed on the whole dataset (coded as partition ‘ALL’).

Parameters: metric_id – unique identifier of the metric
get_global_value(metric_id)

Get the global value of a given metric, or throws.

For a partitioned dataset, the global value is the value of the metric computed on the whole dataset (coded as partition ‘ALL’).

Parameters: metric_id – unique identifier of the metric
get_partition_data(metric_id, partition)

Get the value point of a given metric for a given partition, or throws.

Parameters: metric_id – unique identifier of the metric partition – partition identifier
get_partition_value(metric_id, partition)

Get the value of a given metric for a given partition, or throws.

Parameters: metric_id – unique identifier of the metric partition – partition identifier
get_first_partition_data(metric_id)

Get a value point of a given metric, or throws. The first value encountered is returned.

Parameters: metric_id – unique identifier of the metric
get_partition_data_for_version(metric_id, version_id)

Get for a metric the first partition matching version_id :param metric_id: unique identifier of the metric :param version_id: unique identifier of the version :return:

get_all_ids()

Get the identifiers of all metrics defined in this object

static get_value_from_data(data)

Retrieves the value from a metric point, cast in the appropriate type (str, int or float).

For other types, the value is not cast and left as a string.

Parameters: data – a value point for a metric, retrieved with dataiku.ComputedMetrics.get_global_data() or dataiku.ComputedMetrics.get_partition_data()

## dataikuapi package API¶

class dataikuapi.dss.metrics.ComputedMetrics(raw)
get_metric_by_id(id)
get_global_data(metric_id)
get_global_value(metric_id)
get_partition_data(metric_id, partition)
get_partition_value(metric_id, partition)
get_first_partition_data(metric_id)
get_all_ids()
static get_value_from_data(data)