Calculated metrics API - GET a calculated metric

Gets the descriptor of the specified calculated service metric.

The request produces an application/json payload.

This request is an Early Adopter release and may be changed in non-compatible way.

GET
  • Managed 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}

Parameters

Parameter Type Description In Required
metricKey string

The key of the required calculated service metric.

path required

Response format

Refer to JSON models to find all JSON models that depend on the type of the model.

The CalculatedServiceMetric object

Descriptor of a calculated service metric.

Element Type Description
metadata ConfigurationMetadata

Metadata useful for debugging.

tsmMetricKey string

The key of the calculated service metric.

name string

The displayed name of the metric.

enabled boolean

The metric is enabled (true) or disabled (false).

metricDefinition CalculatedMetricDefinition

The source of the 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 UNSPECIFIED.

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 dimensions splitting of the metric.

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 {name}.

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 (regex) or the position of request attribute value to be extracted. Does not need to be specified if attribute is SERVICE_REQUEST_ATTRIBUTE and aggregation is COUNT.

delimiterOrRegex string

Depending on the type value:

  • REGEX_EXTRACTION: The regular expression.
  • BETWEEN_DELIMITER: The opening delimiter string to look for.
  • All other values: The delimiter string to look for.
endDelimiter string

The closing delimiter string to look for.

Required if the kind value is BETWEEN_DELIMITER. Not applicable otherwise.

requestAttribute string

The request attribute to extract from.

Required if the kind value is SERVICE_REQUEST_ATTRIBUTE. Not applicable otherwise.

normalization string

The format of the extracted string.

useFromChildCalls boolean

Only applicable for SERVICE_REQUEST_ATTRIBUTE. If true request attribute will be taken from a child service call.

Defaults to false

aggregation string

Only applicable for SERVICE_REQUEST_ATTRIBUTE when useFromChildCalls is true. When the request attribute occurs across multiple child requests the value may differ. Specify which value should be taken. If COUNT is used, then no kind needs to be specified.

The Condition object

A condition of a rule usage.

Element Type Description
attribute string

The attribute to be matched.

comparisonInfo ComparisonInfo

How to match the attribute.

The ComparisonInfo object

Type-specific comparison for attributes. The actual set of fields depends on the type of the comparison.

Element Type Description
comparison Enum

Operator of the comparision. You can reverse it by setting negate to true.

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:

STRING -> StringComparisonInfo NUMBER -> NumberComparisonInfo BOOLEAN -> BooleanComparisonInfo HTTP_METHOD -> HttpMethodComparisonInfo STRING_REQUEST_ATTRIBUTE -> StringRequestAttributeComparisonInfo NUMBER_REQUEST_ATTRIBUTE -> NumberRequestAttributeComparisonInfo ZOS_CALL_TYPE -> ZosComparisonInfo IIB_INPUT_NODE_TYPE -> IIBInputNodeTypeComparisonInfo ESB_INPUT_NODE_TYPE -> ESBInputNodeTypeComparisonInfo FAILED_STATE -> FailedStateComparisonInfo FLAW_STATE -> FlawStateComparisonInfo FAILURE_REASON -> FailureReasonComparisonInfo HTTP_STATUS_CLASS -> HttpStatusClassComparisonInfo TAG -> TagComparisonInfo FAST_STRING -> FastStringComparisonInfo SERVICE_TYPE -> ServiceTypeComparisonInfo

The Enum object

Element Type Description

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 REQUEST_ATTRIBUTE.

The ConfigurationMetadata object

Metadata useful for debugging

Element Type Description
clusterVersion string

Dynatrace server version.

configurationVersions integer[]

A Sorted list of the version numbers of the configuration.

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