## MetricBase transforms

Log in to subscribe to topics and get notified when content changes.

# MetricBase transforms

Transforms enable you to visualize MetricBase data in different ways.

## Available transforms

All transforms except for the Label transform are mathematical functions you can apply to the metrics data. Apply multiple transforms to create a transform chain.
Transform Description
Add Calculates an outcome by adding the specified value to the data points in the dataset.
Average Calculates the arithmetic means of all currently selected metrics.
Bottom Shows only the lowest specified number of values of the metric dataset.
Chi-square Shows how well a statistical model fits the metric dataset.
Count Shows the count of data points within the metric dataset.
Decompose Separates out components of predictive models. You can decompose and request both the min and the max to get the lower and upper bounds of a predictive model.
Divide Calculates an outcome by dividing the data points in the dataset by a specified value.
Envelope Shows the minimum and maximum values of the metric dataset.
Filter Produces a new series with values calculated using the given aggregation function over a sliding time window of the given duration. A sliding 15-minute average would use the Filter transform with the Average aggregation function and a duration of 15 minutes.
Supported aggregation functions:
• AVG
• CHISQUARE
• LAST
• MAX
• MEDIAN
• MIN
• STDDEV
Fit Generates a prediction model that can be used by the model-based trigger.
Fractiles Returns a new series with values representing the given percentiles of the underlying data. For example, to query for the 90th and 99th percentile response times, supply an array of [0.9,0.99].
Interpolate Constructs new data points a specified duration to calculate an outcome.
Label Enables you to set a label for your transform.
Last Returns the last defined value in the period window.
Log Calculates the natural logarithm of all values in the dataset.
Max Shows the largest value at each point in time for the metric dataset.
Median Shows the median of the metric dataset. The median separates the higher values of the metric dataset from the lower values.
Min Shows the smallest value at each point in time for the metric dataset.
Multiply Calculates an outcome by multiplying the data points in the dataset by a specified value.
Partition Produces a new series with values calculated using the given aggregation function over a fixed time frame of a given duration. Specify the Base (a timestamp) to align the partition window.
Supported aggregation functions:
• AVG
• CHISQUARE
• LAST
• MAX
• MEDIAN
• MIN
• STDDEV
Predict Compares predicted time-series data generated by the prediction model selected in the MetricBase Models table (mb_model) to real data. The predicted and real data can be graphed. Prediction triggers are based on the predicted values as well as thresholds. Thresholds are values above and below the predicted value. Real data that falls outside of those thresholds execute prediction triggers.
Put Copies a time-series metric into a different MetricBase time-series metric, for example, `copyData('targetMetric').put()`.
Resample Expands or contracts the data to fit the given period. When you extend the period, the aggregation function is used to combine the data to fit the new period. When you shorten the period, the existing data is propagated to the underlying periods.
Supported aggregation functions:
• AVG
• CHISQUARE
• LAST
• MAX
• MEDIAN
• MIN
• STDDEV
Standard Deviation Calculates the standard deviation across the underlying data. Used to quantify the variation or dispersion of a set of data values in the metric dataset.
Subtract Calculates an outcome by subtracting the specified value from the data points in the dataset.
Sum Calculates the sum of the data points within the metric dataset. See Sum transform for more information.
Top Shows only the highest specified number of values of the metric dataset.

## Sum transform

A value at timestamp “T” denotes the value for the range (T-period, T). In your query, sum() gives the input series. You have one series and then you resample the original series into a new series with period = 1 day. When you resample the original series to a period, it creates two data points (2000-04-02T00:00:00Z and 2000-04-03T00:00:00Z). The value at 2000-04-02T00:00:00Z is 1 because there is one data point. The value at 2000-04-03T00:00:00Z is calculated by aggregating values in the range (2000-04-02T00:00:00Z, 2000-04-03T00:00:00Z]. The value is equals 3.  In this example, the result of
```var startTime = new GlideDateTime('2000-04-02 00:00:00');
var endTime = new GlideDateTime('2000-04-02 23:00:00');
transformer.metric('u_cost').sum().resample('SUM', GlideDuration('1 00:00:00'))```
is [1, 3] rather than .
```====== rest api result for GET ======
{
"seriesRef": {
"subject": "28e6bf5d73c233000355bccdbdf6a70c",
"table": "sn_cld_intg_aws_cost_usage",
"metric": "u_cost"
},
"label": "28e6bf5d73c233000355bccdbdf6a70c:sn_cld_intg_aws_cost_usage|u_cost",
"values": [
{
"timestamp": "2000-04-02T00:00:00Z",
"value": 1
},
{
"timestamp": "2000-04-02T01:00:00Z",
"value": 1
},
{
"timestamp": "2000-04-02T02:00:00Z",
"value": 1
},
{
"timestamp": "2000-04-02T03:00:00Z",
"value": 1
},
{
"timestamp": "2000-04-02T04:00:00Z",
"value": 0
},
{
"timestamp": "2000-04-02T05:00:00Z",
"value": 0
},
...
{
"timestamp": "2000-04-02T23:00:00Z",
"value": 0
},
{
"timestamp": "2000-04-03T00:00:00Z",
"value": 0
}
]
}```
Feedback