make_metric

Type of operation: Metadata, Metrics

Description

Creates a metric interfaced event dataset from an event, interval, or resource dataset.

make_metric must specify 1 or more “metric” columns which are of numeric type and specify a “groupby” function which takes in the tag columns that a user would like to bring forward. The types of “metric” columns currently accepted are the int64, float64, and numeric typed columns. “metric” columns which don’t have one of the three types will be rejected by the verb. For the “groupby” function, the user can bring forward any of the existing columns from the dataset as tags as long as the column is not used as one of the “metric” columns and not a “valid_from” (or “valid_to” columns) of the dataset. If any of the columns chosen within “metric” or “groupby” clashes with the name “timestamp”, “metric”, and “value, it will ask the user to rename the column.

The “valid_from” column of the original dataset will be automatically renamed into a “timestamp” column, while the “valid_to” column will be dropped, which means the final output of the dataset would be an event typed dataset, where each metric seems to be reported at one specific moment in time.

The “metric” columns chosen by this verb will be collapsed into two columns that store “metric” and “value”. The “metric” column will store the name of columns the user has chosen to be used for the “metric” arguments, while the the “value” column will store the value of the columns the user has chosen within the “metric” arguments mapepd by the name of the column.

The “groupby” columns chosen will be brought forward as part of the output dataset to show the tags around each “metric” and “value” pair.

All other columns will be dropped as a result of this verb.

Ultimately, this verb helps user to avoid the tedious steps involved in publishing a metric dataset, where a user would need to manually filter down the original dataset’s metadata using the “pick_col” and “unpivot” verbs (and optionally a “make_event” verb).

Usage

make_metric metric_1, metric_2, ..., [ groupby ]

Argument

Type

Optional

Repeatable

Restrictions

metric

numeric

no

yes

column

groupby

grouping

yes

no

constant

Accelerable

make_metric 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_metric avg_cpu_usage, group_by()

From the input dataset, it creates an event dataset with the “Valid From” field renamed into “timestamp”, along with the “metric” and “value” columns collapsed from the first 1 “metric” column (avg_cpu_usage) and 0 “groupby” column brought forward. All other columns are dropped from the input dataset.

make_metric min_populateMaterializationInfo_seconds, max_populateMaterializationInfo_seconds, group_by(customer_id)

From the input dataset, it creates an event dataset with the “Valid From” field renamed into “timestamp”, along with the “metric” and “value” columns collapsed from the first 2 “metric” columns (min_populateMaterializationInfo_seconds, max_populateMaterializationInfo_seconds) and 1 “groupby” column (customer_id) brought forward. All other columns are dropped from the input dataset.

make_metric min_populateMaterializationInfo_seconds, max_populateMaterializationInfo_seconds, min_populateDatasets_seconds, max_populateDatasets_seconds, min_total_seconds, max_total_seconds, group_by(podName, containerName, clusterUid, nodeName, namespace, containerId, customer_id)

From the input Interval dataset, creates an event dataset with the “_c_valid_from” renamed into “timestamp”, along with the “metric” and “value” columns collapsed from the first 6 “metric” columns and the 7 “groupby” columns brought forward. All other columns are dropped from the interval dataset.