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 ID of the calculated service metric you're inquiring.

path required

Response format

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

The ServiceMetric object

Element Type Description
metadata ConfigurationMetadata

Metadata useful for debugging.

tsmMetricKey string

A unique metric key.

name string

The name of this calculated service metric.

enabled boolean

Calculated service metric enabled/disabled.

metricDefinition MetricDefinition

Metric source.

unit string

Metric unit.

unitDisplayName string

The unit display name, if unit is unspecified.

entityId string

Specifies the service entity id for which this metric should be created.

managementZones string[]

Specifies the management zones for which this metric should be created.

conditions Condition[]

Specifies the conditions a request must fulfill for the calculated service metric to be created.

dimensionDefinition DimensionDefinition

Specifies the optional dimension.

The DimensionDefinition object

Element Type Description
name string

The name of this dimension.

dimension string

The dimension of this metric.

placeholders Placeholder[]

The list of extractions to be inserted into the dimension.

topX integer

The number of top values to be calculated.

topXDirection string

How the topX need to be calculated.

topXAggregation string

The aggregation of the dimension.

The Placeholder object

The custom placeholder to be used in the request rule naming pattern.

It enables you to extract a request attribute value or other request attribute and use it in the request 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.

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.

The Condition object

A condition for the request naming 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 information 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 the begin with into does not begin with.

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 FAILED_STATE -> FailedStateComparisonInfo FLAW_STATE -> FlawStateComparisonInfo FAILURE_REASON -> FailureReasonComparisonInfo HTTP_STATUS_CLASS -> HttpStatusClassComparisonInfo TAG -> TagComparisonInfo FAST_STRING -> FastStringComparisonInfo

The Enum object

Element Type Description

The MetricDefinition object

Element Type Description
metric string

Service metric to be captured.

requestAttribute string

The request attribute this metric should capture.

The ConfigurationMetadata object

Metadata useful for debugging

Element Type Description
configurationVersions integer[]

A Sorted list of the version numbers of the configuration.

clusterVersion string

Dynatrace server version.

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