Skip to main content

List Metrics

You can narrow down the output by selecting metrics in the metricSelector field.

You can additionally limit the output by using pagination:

  1. Specify the number of results per page in the pageSize query parameter.

  2. Then use the cursor from the nextPageKey field of the response in the nextPageKey query parameter to obtain subsequent pages. All other query parameters must be omitted.

Basic Parameters

ParameterDescription
QueryMetric registry search term. Only show metrics that contain the term in their key, display name, or description. Use the metricSelector parameter instead of this one to select a complete metric hierarchy instead of doing a text-based search.

Advanced Parameters

ParameterDescription
FieldsDefines the list of metric properties included in the response.

metricId is always included in the result. The following additional properties are available:

displayName: The name of the metric in the user interface. Enabled by default.
description: A short description of the metric. Enabled by default.
unit: The unit of the metric. Enabled by default.
tags: The tags of the metric.
+ dduBillable: An indicator whether the usage of metric consumes Davis data units.
created: The timestamp (UTC milliseconds) when the metrics has been created.
lastWritten: The timestamp (UTC milliseconds) when metric data points have been written for the last time.
aggregationTypes: The list of allowed aggregations for the metric. Note that it may be different after a transformation is applied.
defaultAggregation: The default aggregation of the metric. It is used when no aggregation is specified or the :auto transformation is set.
dimensionDefinitions: The fine metric division (for example, process group and process ID for some process-related metric).
transformations: A list of transformations that can be applied to the metric.
entityType: A list of entity types supported by the metric.
minimumValue: The minimum allowed value of the metric.
maximumValue: The maximum allowed value of the metric.
rootCauseRelevant: Whether (true or false) the metric is related to a root cause of a problem. A root-cause relevant metric represents a strong indicator for a faulty component.
impactRelevant: Whether (true or false) the metric is relevant to a problem's impact. An impact-relevant metric is highly dependent on other metrics and changes because an underlying root-cause metric has changed.
metricValueType: The type of the metric's value. You have these options:
score: A score metric is a metric where high values indicate a good situation, while low values indicate trouble. An example of such a metric is a success rate.
error: An error metric is a metric where high values indicate trouble, while low values indicate a good situation. An example of such a metric is an error count.
latency: The latency of the metric, in minutes. The latency is the expected reporting delay (for example, caused by constraints of cloud vendors or other third-party data sources) between the observation of a metric data point and its availability in Dynatrace. The allowed value range is from 1 to 60 minutes.
metricSelector: The underlying metric selector used by a func: metric.
scalar: Indicates whether the metric expression resolves to a scalar (true) or to a series (false).
A scalar result always contains one data point. The amount of data points in a series result depends on the resolution you're using.
resolutionInfSupported: If true, resolution=Inf can be applied to the metric query.

To add properties, list them with leading plus +. To exclude default properties, list them with leading minus -.

To specify several properties, join them with a comma (for example fields=+aggregationTypes,-description).

If you specify just one property, the response contains the metric key and the specified property. To return metric keys only, specify metricId here.
Metadata SelectorThe metadata scope of the query. Only metrics with specified properties are included to the response.

You can set one or more of the following criteria. Values are case-sensitive and the EQUALS operator is used. If several values are specified, the OR logic applies.

unit("unit-1","unit-2")
tags("tag-1","tag-2")
dimensionKey("dimkey-1","dimkey-2"). The filtering applies only to dimensions that were written within the last 14 days.
custom("true"). "true" to include only user-defined metrics metrics (without namespace or with ext:, calc:, func:, appmon:), "false" to filter them out.

To set several criteria, separate them with a comma (,). For example, tags("feature","cloud"),unit("Percent"),dimensionKey("location"),custom("true"). Only results matching all criteria are included in response.

For example, to list metrics that have the tags feature AND cloud with a unit of Percent OR MegaByte AND a dimension with a dimension key location, use this metadataSelector: tags("feature"),unit("Percent","MegaByte"),tags("cloud"),dimensionKey("location").
Metric SelectorSelects metrics for the query by their keys.

You can specify multiple metric keys separated by commas (for example, metrickey1,metrickey2). To select multiple metrics belonging to the same parent, list the last part of the required metric keys in parentheses, separated by commas, while keeping the common part untouched. For example, to list the builtin:host.cpu.idle and builtin:host.cpu.user metric, write: builtin:host.cpu.(idle,user).

You can select a full set of related metrics by using a trailing asterisk (*) wildcard. For example, builtin:host.* selects all host-based metrics and builtin:* selects all Dynatrace-provided metrics.

You can set additional transformation operators, separated by a colon (:). See Metrics selector transformations in Dynatrace Documentation for additional information on available result transformations and syntax.

Only aggregation, merge, parents, and splitBy transformations are supported by this endpoint.

If the metric key contains any symbols you must quote (") the key. The following characters inside of a quoted metric key must be escaped with a tilde (~):

Quotes (")
Tildes (~)

For example, to query the metric with the key of ext:selfmonitoring.jmx.Agents: Type "APACHE" you must specify this selector:

"ext:selfmonitoring.jmx.Agents: Type ~"APACHE~""



To find metrics based on a search term, rather than metricId, use the text query parameter instead of this one.
Next Page KeyThe cursor for the next page of results. You can find it in the nextPageKey field of the previous response.

The first page is always returned if you don't specify the nextPageKey query parameter.

When the nextPageKey is set to obtain subsequent pages, you must omit all other query parameters.
Page SizeThe amount of metric schemata in a single response payload.

The maximal allowed page size is 500.

If not set, 100 is used.

If a value higher than 500 is used, only 500 results per page are returned.
Written SinceFilters the resulted set of metrics to those that have data points within the specified timeframe.

You can use one of the following formats:
Timestamp in UTC milliseconds.
Human-readable format of 2021-01-25T05:57:01.123+01:00. If no time zone is specified, UTC is used. You can use a space character instead of the T. Seconds and fractions of a second are optional.
Relative timeframe, back from now. The format is now-NU/A, where N is the amount of time, U is the unit of time, and A is an alignment. The alignment rounds all the smaller values to the nearest zero in the past. For example, now-1y/w is one year back, aligned by a week.
You can also specify relative timeframe without an alignment: now-NU.
Supported time units for the relative timeframe are:
m: minutes
h: hours
d: days
w: weeks
M: months
* y: years.

Example Output

{
"metrics": [
{
"aggregationTypes": [
"auto",
"value"
],
"created": 1597400123451,
"dduBillable": false,
"defaultAggregation": {
"type": "value"
},
"description": "Percentage of user-space CPU time currently utilized, per host.",
"dimensionDefinitions": [
{
"displayName": "Host",
"index": 0,
"key": "dt.entity.host",
"name": "Host",
"type": "ENTITY"
}
],
"displayName": "CPU user",
"entityType": [
"HOST"
],
"lastWritten": 1597400717783,
"metricId": "builtin:host.cpu.user:splitBy(\"dt.entity.host\"):max:fold",
"metricValueType": {
"type": "unknown"
},
"tags": [],
"transformations": [
"filter",
"fold",
"limit",
"merge",
"names",
"parents",
"timeshift",
"rate",
"sort",
"last",
"splitBy"
],
"unit": "Percent"
},
{
"aggregationTypes": [
"auto",
"value"
],
"created": 1597400123451,
"dduBillable": false,
"defaultAggregation": {
"type": "value"
},
"description": "Percentage of user-space CPU time currently utilized, per host.",
"dimensionDefinitions": [
{
"displayName": "Host",
"index": 0,
"key": "dt.entity.host",
"name": "Host",
"type": "ENTITY"
}
],
"displayName": "CPU user",
"entityType": [
"HOST"
],
"lastWritten": 1597400717783,
"metricId": "builtin:host.cpu.user:splitBy()",
"metricValueType": {
"type": "unknown"
},
"tags": [],
"transformations": [
"filter",
"fold",
"limit",
"merge",
"names",
"parents",
"timeshift",
"rate",
"sort",
"last",
"splitBy"
],
"unit": "Percent"
}
],
"nextPageKey": "ABCDEFABCDEFABCDEF_",
"totalCount": 3
}

Workflow Library Example

List Metrics with Dynatrace and Send Results Via Email

Workflow LibraryPreview this Workflow on desktop