Function: window(set[], options={})
Given an arbitrary number of series, moves a windowing function across each series to return a set of equal length. The size of the window and the function to compute across each window are configurable. A common use of this function is to smooth a noisy set of series by averaging local variance over a wider period of samples.
Windows are always calculated with points previous to, and including, the current point in time and operate with a fixed number of data points. This is also commonly referred to as the Simple Moving Average when computing the mean of the data points across the window.
The options map accepts the following keys:
size
- The size of the window specified in the number of inclusive, previous points over which to compute the window function. At each point in the set of the input series, the window will be computed using the current point plus thesize - 1
previous points. If there are notsize - 1
previous points the current point will be dropped from the returned set. This means that for an input series of N points, the returned series will haveN - (size - 1)
points, the firstsize - 1
points having been dropped from the result. The default size of a window if not specified is 1 – ie, no windowing. The maximum value issize:"64"
.function
- The function parameter defines the function that is computed over each moving window of points. The values are:mean
,sum
,min
,max
, andmedian
. The default function, if not specified, ismean
.
Example:
The following expression plots the median values of the metric api.auth.time.p99
over a window of 5 points.
window(max(s("api.auth.time.p99", {"@host":"*"})), {size: "5", function:"median"})
The resulting chart demonstrates how the window function will smooth out any noise.
The chart includes the bare metric api.auth.time.p99
for comparison, which displays
many spikes not seen in the composite metric.
Composite metrics that you set up for alerting and that use window()
or moving_average()
functions use a start time of the query 15 minutes in the past,
effectively allowing a maximum window size of 15 minutes for the query.
Navigation Notice: When the APM Integrated Experience is enabled, AppOptics shares a common navigation and enhanced feature set with other integrated experience products. How you navigate AppOptics and access its features may vary from these instructions.
The scripts are not supported under any SolarWinds support program or service. The scripts are provided AS IS without warranty of any kind. SolarWinds further disclaims all warranties including, without limitation, any implied warranties of merchantability or of fitness for a particular purpose. The risk arising out of the use or performance of the scripts and documentation stays with you. In no event shall SolarWinds or anyone else involved in the creation, production, or delivery of the scripts be liable for any damages whatsoever (including, without limitation, damages for loss of business profits, business interruption, loss of business information, or other pecuniary loss) arising out of the use of or inability to use the scripts or documentation.