Skip to main content

Dynatrace Metrics ExecModule

Overview​

DynatraceMetricsModule reads metric time series from a single Dynatrace Classic SaaS environment through the Metrics API v2. It returns metric IDs, dimensions, and timestamped values that a workflow can use to compare resource usage before and after a rollout, collect evidence around an alert, or summarize a scheduled measurement window.

Use this module for environments that support the Classic Metrics API v2. Workflows that query Grail use the separate Dynatrace Query Language API.

Usage​

  1. Find the Classic SaaS environment ID and create an access token scoped to metrics.read.
  2. Ask a deployment administrator to approve the exact {environment-id}.live.dynatrace.com hostname for outbound workflow traffic.
  3. Create a READY Dynatrace connection in the Integration Account Console. Add Dynatrace Metrics to a workflow and select the connection under General > Connection.
  4. Enter a metric selector, map the observation window, and use an entity selector when the workflow needs to focus on specific monitored resources.
  5. Check status before using the metric data. A successful response can have no matching data. Handle missing points before applying thresholds or calculating aggregates.

Inputs​

InputTypePurpose
metricSelectorstringRequired Dynatrace metric selector, up to 2,048 characters. Supports metric keys and selector syntax accepted by Metrics API v2.
entitySelectorstringOptional Dynatrace entity selector, up to 1,024 characters. Restricts the query to matching entities.
fromstringRequired start of the window as an ISO 8601 UTC timestamp.
tostringRequired end of the window as an ISO 8601 UTC timestamp. It must follow from by at most 24 hours.
resolutionintegerTarget number of points per series. Accepts 1–1,000 and defaults to 120. Dynatrace chooses the effective interval.

Outputs​

OutputTypeMeaning
statusstringsuccess or error.
resultsarrayMetric objects containing metricId and a data array of series. Each series has a dimensionMap and aligned timestamps and values arrays.
countintegerNumber of metric objects in results.
resolutionstringEffective timeslot resolution when provided by Dynatrace.
totalCountintegerProvider count of primary entities when available. It can differ from the number of metrics, series, or points.
httpStatusintegerProvider HTTP status when available.
attemptsintegerNumber of provider request attempts.
errorobjectSanitized failure details including a code, message, and retryability flag.

Timestamps are Unix epoch milliseconds. Pair each timestamp with the value at the same index. A null value indicates a missing measurement. An empty dimension map can represent an aggregate series. Dynatrace labels points with the end of their timeslot, so the final point can have a timestamp later than the requested end.

IntegrationAccount Requirements​

Use an authorized, saved READY IntegrationAccount for the dynatrace provider. Put the environment ID in accountId. Use only the single lowercase hostname label, with letters, digits, and hyphens. Store the Classic access token in the encrypted apiKey field. Grant it only the metrics.read scope needed by this operation.

Keep the token in the connection. The workflow sends it through the guarded HTTPS route in the Dynatrace authorization header. Select only the telemetry needed downstream and use destinations approved to receive those data.

Configuration​

Set the selectors, window, and resolution in module configuration or map them at runtime. The destination comes from the selected account and the fixed live.dynatrace.com suffix. The deployment operator must allow the exact hostname through valkyrai.security.network.allowed-destinations or VALKYRAI_SECURITY_NETWORK_ALLOWED_DESTINATIONS. The module uses TLS verification and refuses redirects.

Operations​

The module sends GET /api/v2/metrics/query with URL-encoded selectors, UTC epoch-millisecond bounds, and the target resolution. Each successful call returns a single JSON response. The operation reads Classic metrics and leaves Dynatrace resources unchanged.

Errors and Failure Modes​

Invalid inputs, unavailable credentials, and a denied destination stop the workflow step before querying Dynatrace. If Dynatrace rejects the query, check the selector in Classic Data Explorer, confirm that the selected environment contains the metric, and verify the token's scope.

Transient transport failures and HTTP 408, 429, 500, 502, 503, and 504 can retry within a two-attempt budget. The module waits at most five seconds for an inline retry. Use workflow scheduling or retry controls when the provider calls for a longer delay. If the response exceeds 5 MiB, shorten the window, lower the resolution target, or focus the query on fewer entities. Error details omit credentials, query text, and the raw provider body.

Example​

A release workflow reads CPU usage for one host during the 15 minutes after a deployment. The host identifier is illustrative.

{
"metricSelector": "builtin:host.cpu.usage",
"entitySelector": "entityId(\"HOST-0990886B7D39FE29\")",
"from": "2026-10-27T14:00:00Z",
"to": "2026-10-27T14:15:00Z",
"resolution": 3
}

A successful result might contain three points at five-minute intervals.

{
"status": "success",
"results": [
{
"metricId": "builtin:host.cpu.usage",
"data": [
{
"dimensionMap": {"dt.entity.host": "HOST-0990886B7D39FE29"},
"timestamps": [1793109900000, 1793110200000, 1793110500000],
"values": [41.8, 52.1, 47.0]
}
]
}
],
"count": 1,
"resolution": "5m",
"totalCount": 1,
"httpStatus": 200,
"attempts": 1
}

Map the series into a release report with the host and observed time window. Apply the same selector and resolution to an earlier window when comparing with a baseline.

Notes​

  • Pagination. The query endpoint has no active continuation cursor. Use smaller windows or narrower entity selectors for large queries.
  • Rate limits. Dynatrace throttles requests per environment. Stagger recurring workflows and scope queries to the resources they need.
  • API limits. Dynatrace limits selectors to ten metrics per query and also limits the number of tuples and points it processes. The module covers bounded Classic SaaS metrics reads. Grail DQL, ActiveGate, self-managed endpoints, ingestion, and administration require separate integrations.
  • Idempotency and destructive behavior. Reads leave the environment unchanged. Late-arriving metrics and retention can change the results of a repeated read, even when the query window is identical.

See the Dynatrace Metrics API v2 query reference and metric selector reference.