# interface¶

## Description¶

Map fields of this dataset to a pre-defined interface.

For each well-defined interface, some number of field:type mappings are defined, which makes the dataset work according to the needs of that interface. The most common such interface is “metric” which makes Observe calculate summaries of the metrics, and present them in the metric browser. Each named field in the interface is also referred to as a interface field name because the name identifies a particular role for the field (for example “this field is the name of this metric.”)

The “metric” interface requires the following fields:

Name

Type

Meaning

metric

string

The metric name.

value

float64

The metric value.

If a column of the expected name and type already exists, it will be picked up as the “right” column, whereas if the intended column has another name, you will need to specify it:

interface "metric", metric:my_name, value:the_reading


This interface can currently bind these interface field names to fields with different names, without renaming the columns, such as shown in one of the examples below. For example, there may be a field named “my_name” that is bound to the “metric” interface field name because it contains the metric name in this dataset. Because using a differently-named column for the particular interface field can be confusing, Observe strongly recommends making the name of the field be the same as the name of the interface field – use rename_col metric:my_name before declaring interface "metric".

## Usage¶

interface interfaceName, fieldBinding ...


Argument

Type

Required

Multiple

interfaceName

string

Required

Only one

fieldBinding

expression

Required

Can be multiple

## Accelerable¶

interface is always accelerable if the input is accelerable. A dataset that only uses accelerable verbs can be accelerated, making queries on the dataset respond faster.

## Examples¶

make_col metric:string(FIELDS.metric_name), value:float64(FIELDS.sample_value)
interface "metric"


Make this dataset implement the ‘metric’ interface, after first extracting the metric name and metric value from the FIELDS object. Because the columns have names matching the interface needs, they don’t need to be named again.

interface "metric", metric:metricNameColumn, value:metricValueColumn


Make this dataset implement the ‘metric’ interface. Bind the existing column containing metric names (‘metricNameColumn’) to the ‘metric’ interfaceName, and the existing column containing ‘float64’ metric values (‘metricValueColumn’) to the ‘value’ interfaceName.