Reference to the retainSeries() function

Summary

retainSeries(<expression> [, <metric>|source=<source>|tag=<sourceTag>|tagk=<pointTagKey>])

Filters the expression to display only the time series that match the specified metric, source, source tag, or point tag. To filter by a particular source, source tag, or point tag, specify source=, tag=, or tagk=, respectively. You can specify only one filtering parameter per function call.

Parameters

ParameterDescription
expression Expression that you want to filter.
metric|source=|tag=|tagk= The metric, source, source tag, or point tag to filter by. See filter() Function for an in-depth discussion of source tags, point tags, and when to use them.

Description

The retainSeries() function filters the expression to display only the time series that match the specified metric, source, source tag, or point tag. To filter by a particular source, source tag, or point tag, specify source=, tag=, or tagk=, respectively. Set pointTagKey to the unique point tag key to filter by.

You might be able to use the retainSeries() function to retain only the series that have the synthetic point tag that you define, for example, in conjunction with taggify().

You can specify only one filtering parameter (metric, source, source tag, or point tag) per function call. To filter by multiple parameters, use a retainSeries() call for each parameter. In contrast to filter(), this function supports expanding a source tag.

Examples

In the following example, we first extract all ~sample.requests.* metrics that are in the dev environment.

retain series 1

Then we extract from that series only the series that come from the app-5 source. The resulting chart displays just three series.

retain series 2