# 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.core.metrics.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()

class dataiku.core.metrics.MetricDataPoint(raw)

A value of a metric, on a partition

get_metric()

Returns the metric as a JSON object

get_metric_id()

Returns the metric’s id

get_partition()

Returns the partition on which the value was computed

get_value()

Returns the value of the metric, as a string

get_compute_time()

Returns the time at which the value was computed

get_type()

Returns the type of the value

class dataiku.core.metrics.ComputedChecks(raw)

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

get_check_by_name(check_name)

Retrive the info for a given check

Parameters

check_name – unique identifier of the check

get_global_data(check_name)

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

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

Parameters

check_name – unique identifier of the check

get_global_value(check_name)

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

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

Parameters

check_name – unique identifier of the check

get_partition_data(check_name, partition)

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

Parameters
• check_name – unique identifier of the check

• partition – partition identifier

get_partition_value(check_name, partition)

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

Parameters
• check_name – unique identifier of the check

• partition – partition identifier

get_first_partition_data(check_name)

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

Parameters

check_name – unique identifier of the check

get_all_names()

Get the identifiers of all checks defined in this object

static get_outcome_from_data(data)

Retrieves the value from a check 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 check, retrieved with dataiku.ComputedChecks.get_global_data() or dataiku.ComputedChecks.get_partition_data()

class dataiku.core.metrics.CheckDataPoint(raw)

A value of a check, on a partition

get_check()

Returns the check as a JSON object

get_partition()

Returns the partition on which the value was computed

get_value()

Returns the value of the check, as a string

get_compute_time()

Returns the time at which the value was computed

## 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)