Service metrics API - GET a metric
Gets the descriptor of the specified calculated service metric.
The request produces an application/json
payload.
GET | ManagedDynatrace for Government | https://{your-domain}/e/{your-environment-id}/api/config/v1/calculatedMetrics/service/{metricKey} |
SaaS | https://{your-environment-id}.live.dynatrace.com/api/config/v1/calculatedMetrics/service/{metricKey} | |
Environment ActiveGate | https://{your-activegate-domain}:9999/e/{your-environment-id}/api/config/v1/calculatedMetrics/service/{metricKey} |
Authentication
To execute this request, you need an access token with ReadConfig
scope.
To learn how to obtain and use it, see Tokens and authentication.
Parameters
Parameter | Type | Description | In | Required |
---|---|---|---|---|
metricKey | string | The key of the required calculated service metric. | path | required |
Response
Refer to JSON models to find all JSON models that depend on the type of the model.
Response codes
Code | Type | Description |
---|---|---|
200 | CalculatedServiceMetric | Success |
Response body objects
The CalculatedServiceMetric
object
Descriptor of a calculated service metric.
Element | Type | Description |
---|---|---|
conditions | Condition[] | The set of conditions for the metric usage. All the specified conditions must be fulfilled to use the metric. |
dimensionDefinition | DimensionDefinition | Parameters of a definition of a calculated service metric. |
enabled | boolean | The metric is enabled ( |
entityId | string | Restricts the metric usage to the specified service. This field is mutually exclusive with the managementZones field. |
ignoreMutedRequests | boolean | Metric should ( |
managementZones | string[] | Restricts the metric usage to specified management zones. This field is mutually exclusive with the entityId field. |
metadata | ConfigurationMetadata | Metadata useful for debugging |
metricDefinition | CalculatedMetricDefinition | The definition of a calculated service metric. |
name | string | The displayed name of the metric. |
tsmMetricKey | string | The key of the calculated service metric. |
unit | string | The unit of the metric.
|
unitDisplayName | string | The display name of the metric's unit. Only applicable when the unit parameter is set to |
The Condition
object
A condition of a rule usage.
Element | Type | Description |
---|---|---|
attribute | string | The attribute to be matched. Note that for a service property attribute you must use the comparison of the
|
comparisonInfo | ComparisonInfo | Type-specific comparison for attributes. The actual set of fields depends on the type of the comparison. Find the list of actual objects in the description of the type field or see Service metrics API - JSON models. |
The ComparisonInfo
object
Type-specific comparison for attributes. The actual set of fields depends on the type of the comparison. Find the list of actual objects in the description of the type field or see Service metrics API - JSON models.
Element | Type | Description |
---|---|---|
comparison | string | Operator of the comparision. You can reverse it by setting negate to |
negate | boolean | Reverse the comparison operator. For example, it turns equals into does not equal. |
type | string | Defines the actual set of fields depending on the value. See one of the following objects:
|
value | object | The value to compare to. |
values | object[] | The values to compare to. |
The DimensionDefinition
object
Parameters of a definition of a calculated service metric.
Element | Type | Description |
---|---|---|
dimension | string | The dimension value pattern. You can define custom placeholders in the placeholders field and use them here. |
name | string | The name of the dimension. |
placeholders | Placeholder[] | The list of custom placeholders to be used in a dimension value pattern. |
topX | integer | The number of top values to be calculated. |
topXAggregation | string | The aggregation of the dimension.
|
topXDirection | string | How to calculate the topX values.
|
The Placeholder
object
The custom placeholder to be used as a naming value pattern.
It enables you to extract a request attribute value or other request attribute and use it in the naming pattern.
Element | Type | Description |
---|---|---|
aggregation | string | Which value of the request attribute must be used when it occurs across multiple child requests. Only applicable for the For the
|
attribute | string | The attribute to extract from. You can only use attributes of the string type.
|
delimiterOrRegex | string | Depending on the type value:
|
endDelimiter | string | The closing delimiter string to look for. Required if the kind value is |
kind | string | The type of extraction. Defines either usage of regular expression ( When the attribute is
|
name | string | The name of the placeholder. Use it in the naming pattern as |
normalization | string | The format of the extracted string.
|
requestAttribute | string | The request attribute to extract from. Required if the kind value is |
source | PropagationSource | Defines valid sources of request attributes for conditions or placeholders. |
useFromChildCalls | boolean | If Only applicable for the |
The PropagationSource
object
Defines valid sources of request attributes for conditions or placeholders.
Element | Type | Description |
---|---|---|
managementZone | string | Use only request attributes from services that belong to this management zone.. Use either this or |
serviceTag | UniversalTag | Use only request attributes from services that have this tag. Use either this or |
The UniversalTag
object
Use only request attributes from services that have this tag. Use either this or managementZone
Element | Type | Description |
---|---|---|
context | string | The origin of the tag, such as AWS or Cloud Foundry. For custom tags use the The context is set for tags that are automatically imported by OneAgent (for example, from the AWS console or environment variables). It’s useful for determining the origin of tags when not manually defined, and it also helps to prevent clashes with other existing tags. If the tag is not automatically imported,
|
key | string | The key of the tag. For custom tags, put the tag value here. The key allows categorization of multiple tags. It is possible that there are multiple values for a single key which will all be represented as standalone tags. Therefore, the key does not have the semantic of a map key but is more like a key of a key-value tuple. In some cases, for example custom tags, the key represents the actual tag value and the value field is not set – those are called valueless tags. |
tagKey | UniversalTagKey | - |
value | string | The value of the tag. Not applicable to custom tags. If a tag does have a separate key and value (in the textual representation they are split by the colon ‘:’), this field is set with the actual value. Key-value pairs can occur for automatically imported tags and tags set by rules if extractors are used. |
The UniversalTagKey
object
Element | Type | Description |
---|---|---|
context | string | -
|
key | string | - |
The ConfigurationMetadata
object
Metadata useful for debugging
Element | Type | Description |
---|---|---|
clusterVersion | string | Dynatrace version. |
configurationVersions | integer[] | A sorted list of the version numbers of the configuration. |
currentConfigurationVersions | string[] | A sorted list of version numbers of the configuration. |
The CalculatedMetricDefinition
object
The definition of a calculated service metric.
Element | Type | Description |
---|---|---|
metric | string | The metric to be captured.
|
requestAttribute | string | The request attribute to be captured. Only applicable when the metric parameter is set to |
Response body JSON model
1{2 "conditions": [3 {4 "attribute": "WEBREQUEST_URL_PATH",5 "comparisonInfo": {6 "caseSensitive": false,7 "comparison": "BEGINS_WITH",8 "negate": false,9 "type": "STRING",10 "value": "/url_path"11 }12 }13 ],14 "dimensionDefinition": {15 "dimension": "{myPlaceholder}",16 "name": "my dimension",17 "placeholders": [18 {19 "attribute": "WEBREQUEST_URL_PATH",20 "delimiterOrRegex": "/booking",21 "kind": "BEFORE_DELIMITER",22 "name": "myPlaceholder",23 "normalization": "ORIGINAL",24 "useFromChildCalls": "false"25 }26 ],27 "topX": 10,28 "topXAggregation": "AVERAGE",29 "topXDirection": "DESCENDING"30 },31 "enabled": true,32 "managementZones": [33 "zone1"34 ],35 "metricDefinition": {36 "metric": "CPU_TIME"37 },38 "name": "My Metric",39 "tsmMetricKey": "calc:service.mymetric",40 "unit": "MICRO_SECOND"41}
Example
In this example, the request inquires about the descriptor of the Top database calls per URL metric, which has the metric key of calc:service.topdbcallsperurl. The metric tracks the number of HTTP calls to databases, where the method is POST. The values of the metric are split by the request name.
The API token is passed in the Authorization header.
Curl
1curl -X GET \2 https://mySampleEnv.live.dynatrace.com/api/config/v1/calculatedMetrics/service/calc:service.topdbcallsperurl \3 -H 'Accept: Accept: application/json; charset=utf-8' \4 -H 'Authorization: Api-Token dt0c01.abc123.abcdefjhij1234567890'
Request URL
1https://mySampleEnv.live.dynatrace.com/api/config/v1/calculatedMetrics/service/calc:service.topdbcallsperurl
Response body
1{2 "metadata": {3 "configurationVersions": [4 05 ],6 "clusterVersion": "1.185.0.20191216-221557"7 },8 "tsmMetricKey": "calc:service.topdbcallsperurl",9 "name": "Top database calls per URL",10 "enabled": true,11 "metricDefinition": {12 "metric": "DATABASE_CHILD_CALL_COUNT",13 "requestAttribute": null14 },15 "unit": "COUNT",16 "unitDisplayName": "",17 "entityId": null,18 "managementZones": [19 "Easytravel"20 ],21 "conditions": [22 {23 "attribute": "HTTP_REQUEST_METHOD",24 "comparisonInfo": {25 "type": "HTTP_METHOD",26 "comparison": "EQUALS",27 "value": "POST",28 "negate": false29 }30 }31 ],32 "dimensionDefinition": {33 "name": "{Request:Name}",34 "dimension": "{Request:Name}",35 "placeholders": [],36 "topX": 10,37 "topXDirection": "DESCENDING",38 "topXAggregation": "SINGLE_VALUE"39 }40}
Response code
200