Lists all available metrics.
You can limit the output by using the pagination:
The request produces one of the following types of payload, depending on the value of the Accept request header:
application/json
text/csv; header=present
—a CSV table with header rowtext/csv; header=absent
—a CSV table without header rowIf no Accept header is provided with the request, an application/json
payload is returned.
GET | SaaS | https://{your-environment-id}.live.dynatrace.com/api/v2/metrics |
Environment ActiveGateCluster ActiveGate | https://{your-activegate-domain}:9999/e/{your-environment-id}/api/v2/metrics |
To execute this request, you need an access token with metrics.read
scope.
To learn how to obtain and use it, see Tokens and authentication.
Parameter | Type | Description | In | Required |
---|---|---|---|---|
nextPageKey | string | The 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. | query | optional |
pageSize | integer | The 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. | query | optional |
metricSelector | string | Selects metrics for the query by their keys. You can specify multiple metric keys separated by commas (for example, You can select a full set of related metrics by using a trailing asterisk ( You can set additional transformation operators, separated by a colon ( Only If the metric key contains any symbols you must quote (
For example, to query the metric with the key of ext:selfmonitoring.jmx.Agents: Type "APACHE" you must specify this selector:
To find metrics based on a search term, rather than metricId, use the text query parameter instead of this one. | query | optional |
text | string | Metric registry search term. Only show metrics that contain the term in their key, display name, or description. Use the | query | optional |
fields | string | Defines the list of metric properties included in the response.
To add properties, list them with leading plus To specify several properties, join them with a comma (for example If you specify just one property, the response contains the metric key and the specified property. To return metric keys only, specify | query | optional |
writtenSince | string | Filters the resulted set of metrics to those that have data points within the specified timeframe. You can use one of the following formats:
| query | optional |
metadataSelector | string | The 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
To set several criteria, separate them with a comma ( 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: | query | optional |
Code | Type | Description |
---|---|---|
200 | Metric | Success |
400 | - | Syntax or validation error. metricSelector or fields have syntactic or semantic errors. |
404 | - | A metric has not been found. |
406 | - | Not acceptable. The requested media type is not supported. Check the Accept header of your request. |
4XX | Error | Client side error. |
5XX | Error | Server side error. |
MetricDescriptorCollection
objectA list of metrics along with their descriptors.
Element | Type | Description |
---|---|---|
metrics | Metric | A list of metric along with their descriptors |
nextPageKey | string | The cursor for the next page of results. Has the value of Use it in the nextPageKey query parameter to obtain subsequent pages of the result. |
totalCount | integer | The estimated number of metrics in the result. |
warnings | string[] | A list of potential warnings about the query. For example deprecated feature usage etc. |
MetricDescriptor
objectThe descriptor of a metric.
Element | Type | Description |
---|---|---|
aggregationTypes | string[] | The list of allowed aggregations for this metric.
|
billable | boolean | If Metric expressions don't return this field. |
created | integer | The timestamp of metric creation. Built-in metrics and metric expressions have the value of |
dduBillable | boolean | If Metric expressions don't return this field. |
defaultAggregation | Metric | The default aggregation of a metric. |
description | string | A short description of the metric. |
dimensionCardinalities | Metric | The cardinalities of MINT metric dimensions. |
dimensionDefinitions | Metric | The fine metric division (for example, process group and process ID for some process-related metric). For ingested metrics, dimensions that doesn't have have any data within the last 15 days are omitted. |
displayName | string | The name of the metric in the user interface. |
entityType | string[] | List of admissible primary entity types for this metric. Can be used for the |
impactRelevant | boolean | The metric is ( An impact-relevant metric is highly dependent on other metrics and changes because an underlying root-cause metric has changed. Metric expressions don't return this field. |
lastWritten | integer | The timestamp when the metric was last written. Has the value of |
latency | integer | 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. Metric expressions don't return this field. |
maximumValue | number | The maximum allowed value of the metric. Metric expressions don't return this field. |
metricId | string | The fully qualified key of the metric. If a transformation has been used it is reflected in the metric key. |
metricSelector | string | The metric selector that is used when querying a func: metric. |
metricValueType | Metric | The value type for the metric. |
minimumValue | number | The minimum allowed value of the metric. Metric expressions don't return this field. |
resolutionInfSupported | boolean | If 'true', resolution=Inf can be applied to the metric query. |
rootCauseRelevant | boolean | The metric is ( A root-cause relevant metric represents a strong indicator for a faulty component. Metric expressions don't return this field. |
scalar | boolean | Indicates whether the metric expression resolves to a scalar ( |
tags | string[] | The tags applied to the metric. Metric expressions don't return this field. |
transformations | string[] | Transform operators that could be appended to the current transformation list.
|
unit | string | The unit of the metric. |
unitDisplayFormat | string | The raw value is stored in bits or bytes. The user interface can display it in these numeral systems: Binary: 1 MiB = 1024 KiB = 1,048,576 bytes Decimal: 1 MB = 1000 kB = 1,000,000 bytes If not set, the decimal system is used. Metric expressions don't return this field.
|
warnings | string[] | A list of potential warnings that affect this ID. For example deprecated feature usage etc. |
MetricDefaultAggregation
objectThe default aggregation of a metric.
Element | Type | Description |
---|---|---|
parameter | number | The percentile to be delivered. Valid values are between Applicable only to the |
type | string | The type of default aggregation.
|
MetricDimensionCardinality
objectThe dimension cardinalities of a metric.
Element | Type | Description |
---|---|---|
estimate | integer | The cardinality estimate of the dimension. |
key | string | The key of the dimension. It must be unique within the metric. |
relative | number | The relative cardinality of the dimension expressed as percentage |
MetricDimensionDefinition
objectThe dimension of a metric.
Element | Type | Description |
---|---|---|
displayName | string | The display name of the dimension. |
index | integer | The unique 0-based index of the dimension. Appending transformations such as :names or :parents may change the indexes of dimensions. |
key | string | The key of the dimension. It must be unique within the metric. |
name | string | The name of the dimension. |
type | string | The type of the dimension.
|
MetricValueType
objectThe value type for the metric.
Element | Type | Description |
---|---|---|
type | string | The metric value type
|
{"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}
In this example, the request queries all built-in metrics (metricSelector is set to builtin:*
) available in the mySampleEnv environment. The following fields are included in the response:
To achieve that, the fields query parameter is set to unit,aggregationTypes
.
The API token is passed in the Authorization header.
The response is in application/json
format and is truncated to four entries.
curl -L -X GET 'https://mySampleEnv.live.dynatrace.com/api/v2/metrics?fields=unit,aggregationTypes&metricSelector=builtin:*' \-H 'Authorization: Api-Token dt0c01.abc123.abcdefjhij1234567890' \-H 'Accept: application/json'
https://mySampleEnv.live.dynatrace.com/api/v2/metrics?fields=unit,aggregationTypes&metricSelector=builtin:*
{"totalCount": 1808,"nextPageKey": "___a7acX3q0AAAAGAQAJYnVpbHRpbjoqAQA","metrics": [{"metricId": "builtin:host.cpu.idle","unit": "Percent","aggregationTypes": ["auto","avg","max","min"]},{"metricId": "builtin:host.cpu.load","unit": "Ratio","aggregationTypes": ["auto","avg","max","min"]},{"metricId": "builtin:service.errors.server.count","unit": "Count","aggregationTypes": ["auto","value"]},{"metricId": "builtin:service.keyRequest.count.client","unit": "Count","aggregationTypes": ["auto","value"]}]}
The CSV table with header row looks like this. To obtain it, change the Accept header to text/csv; header=present
.
metricId,unit,aggregationTypesbuiltin:host.cpu.idle,Percent,"[auto, avg, max, min]"builtin:host.cpu.load,Ratio,"[auto, avg, max, min]"builtin:service.errors.server.count,Count,"[auto, value]"builtin:service.keyRequest.count.client,Count,"[auto, value]"
200