Service metrics API - GET a metric
Gets the descriptor of the specified calculated service metric.
The request produces an application/json
payload.
GET |
|
Authentication
To execute this request, you need the Read configuration (ReadConfig
) permission assigned to your API token. 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 | Description |
---|---|
200 | Success |
Response body
The CalculatedServiceMetric object
Descriptor of a calculated service metric.
Element | Type | Description |
---|---|---|
metadata | ConfigurationMetadata | |
tsmMetricKey | string | The key of the calculated service metric. |
name | string | The displayed name of the metric. |
enabled | boolean | The metric is enabled ( |
metricDefinition | CalculatedMetricDefinition | |
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 |
entityId | string | Restricts the metric usage to the specified service. This field is mutually exclusive with the managementZones field. |
managementZones | string[] | Restricts the metric usage to specified management zones. This field is mutually exclusive with the entityId field. |
conditions | Condition[] | The set of conditions for the metric usage. All the specified conditions must be fulfilled to use the metric. |
dimensionDefinition | DimensionDefinition |
The DimensionDefinition object
Parameters of a definition of a calculated service metric.
Element | Type | Description |
---|---|---|
name | string | The name of the dimension. |
dimension | string | The dimension value pattern. You can define custom placeholders in the placeholders field and use them here. |
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. |
topXDirection | string | How to calculate the topX values. |
topXAggregation | string | The aggregation of the dimension. |
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 |
---|---|---|
name | string | The name of the placeholder. Use it in the naming pattern as |
attribute | string | The attribute to extract from. You can only use attributes of the string type. |
kind | string | The type of extraction. Defines either usage of regular expression ( When the attribute is |
delimiterOrRegex | string | Depending on the type value:
|
endDelimiter | string | The closing delimiter string to look for. Required if the kind value is |
requestAttribute | string | The request attribute to extract from. Required if the kind value is |
normalization | string | The format of the extracted string. |
useFromChildCalls | boolean | If Only applicable for the |
aggregation | string | Which value of the request attribute must be used when it occurs across multiple child requests. Only applicable for the For the |
source | PropagationSource |
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 |
The UniversalTag object
Use only request attributes from services that have this tag. Use either this or managementZone
Element | Type | Description |
---|---|---|
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. |
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. |
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, |
The UniversalTagKey object
Element | Type | Description |
---|---|---|
context | string | |
key | string |
The Condition object
A condition of a rule usage.
Element | Type | Description |
---|---|---|
attribute | string | The attribute to be matched. |
comparisonInfo | ComparisonInfo |
The ComparisonInfo object
Type-specific comparison for attributes. The actual set of fields depends on the type
of the comparison.
Element | Type | Description |
---|---|---|
comparison | object | Operator of the comparision. You can reverse it by setting negate to |
value | object | The value to compare 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:
|
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 |
The ConfigurationMetadata object
Metadata useful for debugging
Element | Type | Description |
---|---|---|
configurationVersions | integer[] | A Sorted list of the version numbers of the configuration. |
currentConfigurationVersions | string[] | A Sorted list of string version numbers of the configuration. |
clusterVersion | string | Dynatrace server version. |
{
"tsmMetricKey": "calc:service.mymetric",
"name": "My Metric",
"enabled": true,
"metricDefinition": {
"metric": "CPU_TIME"
},
"managementZones": [
"zone1"
],
"unit": "MICRO_SECOND",
"conditions": [
{
"attribute": "WEBREQUEST_URL_PATH",
"comparisonInfo": {
"type": "STRING",
"comparison": "BEGINS_WITH",
"value": "/url_path",
"negate": false,
"caseSensitive": false
}
}
],
"dimensionDefinition": {
"name": "my dimension",
"dimension": "{myPlaceholder}",
"placeholders": [
{
"name": "myPlaceholder",
"attribute": "WEBREQUEST_URL_PATH",
"kind": "BEFORE_DELIMITER",
"delimiterOrRegex": "/booking",
"normalization": "ORIGINAL",
"useFromChildCalls": "false"
}
],
"topX": 10,
"topXDirection": "DESCENDING",
"topXAggregation": "AVERAGE"
}
}
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
curl -X GET \
https://mySampleEnv.live.dynatrace.com/api/config/v1/calculatedMetrics/service/calc:service.topdbcallsperurl \
-H 'Accept: Accept: application/json; charset=utf-8' \
-H 'Authorization: Api-token abcdefjhij1234567890'
Request URL
https://mySampleEnv.live.dynatrace.com/api/config/v1/calculatedMetrics/service/calc:service.topdbcallsperurl
Response body
{
"metadata": {
"configurationVersions": [
0
],
"clusterVersion": "1.185.0.20191216-221557"
},
"tsmMetricKey": "calc:service.topdbcallsperurl",
"name": "Top database calls per URL",
"enabled": true,
"metricDefinition": {
"metric": "DATABASE_CHILD_CALL_COUNT",
"requestAttribute": null
},
"unit": "COUNT",
"unitDisplayName": "",
"entityId": null,
"managementZones": [
"Easytravel"
],
"conditions": [
{
"attribute": "HTTP_REQUEST_METHOD",
"comparisonInfo": {
"type": "HTTP_METHOD",
"comparison": "EQUALS",
"value": "POST",
"negate": false
}
}
],
"dimensionDefinition": {
"name": "{Request:Name}",
"dimension": "{Request:Name}",
"placeholders": [],
"topX": 10,
"topXDirection": "DESCENDING",
"topXAggregation": "SINGLE_VALUE"
}
}
Response code
200