Skip to main content

Dynatrace

Reading time: 0 minute(s) (0 words)

Dynatrace is a software intelligence platform that monitors and optimizes application performance, development and security, IT infrastructure, and user experience. The Dynatrace Software Intelligence Platform maps, and monitors applications, microservices, container orchestration platforms such as Kubernetes, and IT infrastructure running in multi-cloud and hybrid-cloud environments, and provides automated problem remediation.

Nobl9 integration with Dynatrace allows users to fetch metric datapoints via metric v2 API with a one-minute resolution. Users can provide a custom selector (by providing value for the metricSelector parameter of the API).

caution

Dynatrace's metricSelector allows you to query for multiple metrics at once. Note that Nobl9 treats SLO data points as time series. Effectively, it means that Nobl9 rejects any datapoint with a timestamp already stored for a given SLO.

To avoid uncertainty, query for data points for only one metric.

Scope of support

Nobl9 integration with Dynatrace supports only metrics obtained via the metricSelector clause. For details, see Metrics API - Get Metric Data Points | Dynatrace documentation.

Authentication

When setting up the Nobl9 agent or direct connection to your Dynatrace instance, you must provide an access token with metrics.read scope activated. For details on how to get your token, refer to the Dynatrace API - Tokens and authentication | Dynatrace documentation.

Adding Dynatrace as a data source

You can add the Dynatrace data source using the direct or agent connection methods. For both methods, start with these steps:

  1. Navigate to Integrations > Sources.
  2. Click .
  3. Click the relevant Source icon.
  4. Choose a relevant connection method (Agent or Direct), then configure the source as described below.

Dynatrace direct

Direct configuration in the UI

Direct connection to Dynatrace requires users to enter their credentials which Nobl9 stores safely. To set up this type of connection:

  1. Select one of the following Release Channels:
    • The stable channel is fully tested by the Nobl9 team. It represents the final product; however, this channel does not contain all the new features of a beta release. Use it to avoid crashes and other limitations.
    • The beta channel is under active development. Here, you can check out new features and improvements without the risk of affecting any viable SLOs. Remember that features in this channel may be subject to change.
  2. Add the URL to connect to your data source (mandatory).
    Depending on the type of environment, the URL must match one of the following formats:

    • SaaS: <https://{your-environment-id}.live.dynatrace.com>

    • Managed: <https://{your-domain}/e/{your-environment-id}>

    • Environment ActiveGate: <https://{your-activegate-domain}/e/{your-environment-id}>

  3. Enter the Dynatrace Token (mandatory).
    To use the Dynatrace API, you must provide an access token with metrics.read scope activated. For more information, refer to the Authentication section above.

  1. Select a Project.
    Specifying a project is helpful when multiple users are spread across multiple teams or projects. When the Project field is left blank, Nobl9 uses the default project.
  2. Enter a Display Name.
    You can enter a user-friendly name with spaces in this field.
  3. Enter a Name.
    The name is mandatory and can only contain lowercase, alphanumeric characters, and dashes (for example, my-project-1). Nobl9 duplicates the display name here, transforming it into the supported format, but you can edit the result.
  4. Enter a Description.
    Here you can add details such as who is responsible for the integration (team/owner) and the purpose of creating it.
  5. Specify the Query delay to set a customized delay for queries when pulling the data from the data source.
    • The default value in Dynatrace integration for Query delay is 2 minutes.
    info
    Changing the Query delay may affect your SLI data. For more details, check the Query delay documentation.
  6. Enter a Maximum Period for Historical Data Retrieval.
    • This value defines how far back in the past your data will be retrieved.
    • The value for the maximum period of data retrieval depends on the data source. Check the Replay documentation for details.
    • A greater period can extend the loading time when creating an SLO.
      • The value must be a positive integer.
  7. Enter a Default Period for Historical Data Retrieval.
    • It is used by SLOs connected to this data source.
    • The value must be a positive integer or 0.
    • By default, this value is set to 0. When you set it to >0, you will create SLOs with Replay.
  8. Click Add Data Source.
caution

When you run Replay for the Maximum Period for Historical Data Retrieval for Dynatrace (28 days), remember that due to Dynatrace limitations, there may be 1h of degraded resolution at the beginning of the selected time range.

Direct using CLI - YAML

The YAML for setting up a direct connection to Dynatrace looks like this:

apiVersion: n9/v1alpha
kind: Direct
metadata:
name: dynatrace-direct
displayName: Dynatrace direct
project: dynatrace-direct
spec:
description: Direct integration with Dynatrace
sourceOf:
- Metrics
dynatrace:
url: "https://{your-environment-id}.live.dynatrace.com"
dynatraceToken: ""
queryDelay:
unit: Minute
value: 720
logCollectionEnabled: false
historicalDataRetrieval:
maxDuration:
value: 28
unit: Day
defaultDuration:
value: 7
unit: Day
FieldTypeDescription
queryDelay.unit
mandatory
enumSpecifies the unit for the query delay. Possible values: Second | Minute.
• Check query delay documentation for default unit of query delay for each source.
queryDelay.value
mandatory
numericSpecifies the value for the query delay.
• Must be a number less than 1440 minutes (24 hours).
• Check query delay documentation for default unit of query delay for each source.
logCollectionEnabled
optional
booleanOptional. Defaults to false. Set to true if you'd like your direct to collect event logs. Beta functionality available only through direct release channel. Reach out to support@nobl9.com to activate it.
releaseChannel
mandatory
enumSpecifies the release channel. Accepted values: beta | stable.
Source-specific fields
dynatrace.dynatraceURL
mandatory
stringInterface URL. Depending on the environment, the expected URL format is:
• SaaS: https://{your-environment-id}.live.dynatrace.com
• Managed: https://{your-domain}/e/{your-environment-id}
• ActiveGate: https://{your-activegate-domain}/e/{your-environment-id}
dynatrace.dynatraceToken
mandatory
string, secretA hash that can be generated in the Dynatrace UI. See authentication for more details.
Replay-related fields
historicalDataRetrieval
optional
n/aOptional structure related to configuration related to Replay.
❗ Use only with supported sources.
• If omitted, Nobl9 uses the default values of value: 0 and unit: Day for maxDuration and defaultDuration.
maxDuration.value
optional
numericSpecifies the maximum duration for historical data retrieval. Must be integer ≥ 0. See Replay documentation for values of max duration per data source.
maxDuration.unit
optional
enumSpecifies the unit for the maximum duration of historical data retrieval. Accepted values: Minute | Hour | Day.
defaultDuration.value
optional
numericSpecifies the default duration for historical data retrieval. Must be integer ≥ 0 and maxDuration.
defaultDuration.unit
optional
enumSpecifies the unit for the default duration of historical data retrieval. Accepted values: Minute | Hour | Day.

Dynatrace agent

Agent configuration in the UI

Follow the instructions below to set up an agent connection. Refer to the section above for the descriptions of the fields.

  1. Select one of the following Release Channels:
    • The stable channel is fully tested by the Nobl9 team. It represents the final product; however, this channel does not contain all the new features of a beta release. Use it to avoid crashes and other limitations.
    • The beta channel is under active development. Here, you can check out new features and improvements without the risk of affecting any viable SLOs. Remember that features in this channel may be subject to change.
  2. Add the URL to connect to your data source.

  1. Enter a Project.
  2. Enter a Name.
  3. Create a Description.
  4. In the Advanced Settings you can:
    1. Enter a Maximum Period for Historical Data Retrieval.
    2. Enter a Default Period for Historical Data Retrieval.
  5. Click Add Data Source.
caution

When you run Replay for the Maximum Period for Historical Data Retrieval for Dynatrace (28 days), remember that due to Dynatrace limitations, there may be 1h of degraded resolution at the beginning of the selected time range.

Agent using CLI - YAML

The YAML for setting up an agent connection to Dynatrace looks like this:

apiVersion: n9/v1alpha
kind: Agent
metadata:
name: dynatrace
displayName: Dynatrace Agent
project: dynatrace
spec:
sourceOf:
- Metrics
- Services
releaseChannel: beta
queryDelay:
unit: Minute
value: 720
dynatrace:
url: https://your-environment-id.live.dynatrace.com
historicalDataRetrieval:
maxDuration:
value: 28
unit: Day
defaultDuration:
value: 7
unit: Day
FieldTypeDescription
queryDelay.unit
mandatory
enumSpecifies the unit for the query delay. Possible values: Second | Minute.
• Check query delay documentation for default unit of query delay for each source.
queryDelay.value
mandatory
numericSpecifies the value for the query delay.
• Must be a number less than 1440 minutes (24 hours).
• Check query delay documentation for default unit of query delay for each source.
releaseChannel
mandatory
enumSpecifies the release channel. Accepted values: beta | stable.
Source-specific fields
dynatrace.dynatraceURL
mandatory
stringInterface URL. Depending on the environment, the expected URL format is:
• SaaS: https://{your-environment-id}.live.dynatrace.com
• Managed: https://{your-domain}/e/{your-environment-id}
• ActiveGate: https://{your-activegate-domain}/e/{your-environment-id}
Replay-related fields
historicalDataRetrieval
optional
n/aOptional structure related to configuration related to Replay.
❗ Use only with supported sources.
• If omitted, Nobl9 uses the default values of value: 0 and unit: Day for maxDuration and defaultDuration.
maxDuration.value
optional
numericSpecifies the maximum duration for historical data retrieval. Must be integer ≥ 0. See Replay documentation for values of max duration per data source.
maxDuration.unit
optional
enumSpecifies the unit for the maximum duration of historical data retrieval. Accepted values: Minute | Hour | Day.
defaultDuration.value
optional
numericSpecifies the default duration for historical data retrieval. Must be integer ≥ 0 and maxDuration.
defaultDuration.unit
optional
enumSpecifies the unit for the default duration of historical data retrieval. Accepted values: Minute | Hour | Day.
warning

You can deploy only one agent in one YAML file by using the sloctl apply command.

Deploying Dynatrace agent

When you add the data source, Nobl9 automatically generates a Kubernetes configuration and a Docker command line for you to use to deploy the agent. Both of these are available in the web UI, under the Agent Configuration section. Be sure to swap in your credentials (e.g., replace <DYNATRACE_TOKEN> in the following YAML with your Dynatrace access token with metrics.read scope activated).

If you use Kubernetes, you can apply the supplied YAML config file to a Kubernetes cluster to deploy the agent. It will look something like this:

# DISCLAIMER: This deployment description contains only the fields necessary for the purpose of this demo.
# It is not a ready-to-apply Kubernetes deployment description, and the client_id and client_secret are only exemplary values.

apiVersion: v1
kind: Secret
metadata:
name: nobl9-agent-nobl9-dev-mydynatrace-b
namespace: default
type: Opaque
stringData:
dynatrace_token: <DYNATRACE_TOKEN>
client_id: "unique_client_id"
client_secret: "unique_client_secret"
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: nobl9-agent-nobl9-dogfood-default-dynatrace-agent
namespace: default
spec:
replicas: 1
selector:
matchLabels:
nobl9-agent-name: dynatrace-agent
nobl9-agent-project: default
nobl9-agent-organization: nobl9-dogfood
template:
metadata:
labels:
nobl9-agent-name: dynatrace-agent
nobl9-agent-project: default
nobl9-agent-organization: nobl9-dogfood
spec:
containers:
- name: agent-container
image: nobl9/agent:0.73.2
resources:
requests:
memory: "350Mi"
cpu: "0.1"
env:
- name: N9_CLIENT_ID
valueFrom:
secretKeyRef:
key: client_id
name: nobl9-agent-nobl9-dogfood-default-dynatrace-agent
- name: N9_CLIENT_SECRET
valueFrom:
secretKeyRef:
key: client_secret
name: nobl9-agent-nobl9-dogfood-default-dynatrace-agent
- name: DYNATRACE_TOKEN
valueFrom:
secretKeyRef:
key: dynatrace_token
name: nobl9-agent-nobl9-dogfood-default-dynatrace-agent
# The N9_METRICS_PORT is a variable specifying the port to which the /metrics and /health endpoints are exposed.
# The 9090 is the default value and can be changed.
# If you don’t want the metrics to be exposed, comment out or delete the N9_METRICS_PORT variable.
- name: N9_METRICS_PORT
value: "9090"

Creating SLOs with Dynatrace

Creating SLOs in the UI

Follow the instructions below to create your SLOs with Dynatrace in the UI:

  1. Navigate to Service Level Objectives.

  2. Click .
  3. In step 1 of the SLO wizard, select the Service the SLO will be associated with.

  4. In step 2, select Dynatrace as the Data Source for your SLO, then specify the Metric. You can choose either a Threshold Metric, where a single time series is evaluated against a threshold, or a Ratio Metric, which allows you to enter two time series to compare (for example, a count of good requests and total requests).

    1. Choose the Data Count Method for your ratio metric:
      • Non-incremental: counts incoming metric values one-by-one. So the resulting SLO graph is pike-shaped.
      • Incremental: counts the incoming metric values incrementally, adding every next value to previous values. It results in a constantly increasing SLO graph.
  5. Enter a Metric Selector, or Metric selector for good counter and Metric selector for total counter for the metric you selected.

    • Metric selector selects metrics for the query by their keys.
    • You can select up to 10 metrics for one query. metricSelector can be obtained from the Dynatrace v2 API. In the Custom chart area, select the Try it out button. Then, in the Data Explorer, select the Code tab.

    For more information and query samples, refer to the SLOs using Dynatrace - YAML samples section below.

    SLI values for good and total
    When choosing the query for the ratio SLI (countMetrics), keep in mind that the values ​​resulting from that query for both good and total:
    • Must be positive.
    • While we recommend using integers, fractions are also acceptable.
      • If using fractions, we recommend them to be larger than 1e-4 = 0.0001.
    • Shouldn't be larger than 1e+20.
  6. In step 3, define a Time Window for the SLO.

  7. In step 4, specify the Error Budget Calculation Method and your Objective(s).

  8. In step 5, add a Name, Description, and other details about your SLO. You can also select Alert policies and Labels on this screen.

  9. When you’re done, click Create SLO.

SLOs using Dynatrace - YAML samples

Here’s an example of Dynatrace using a rawMetric (threshold metric):

apiVersion: n9/v1alpha
kind: SLO
metadata:
name: dynatrace-slo-example
project: dynatrace
spec:
service: dynatrace-service
indicator:
metricSource:
name: dynatrace
timeWindows:
- unit: Day
count: 7
isRolling: true
budgetingMethod: Occurrences
objectives:
- displayName: Good
op: lte
rawMetric:
query:
dynatrace:
metricSelector: builtin:synthetic.http.duration.geo:filter(and(in("dt.entity.http_check",entitySelector("type(http_check),entityName(~"API Sample~")")),in("dt.entity.synthetic_location",entitySelector("type(synthetic_location),entityName(~"N. California~")")))):splitBy("dt.entity.http_check","dt.entity.synthetic_location"):avg:auto:sort(value(avg,descending)):limit(20)
value: 150
target: 0.50
- displayName: Moderate
op: lte
rawMetric:
query:
dynatrace:
metricSelector: builtin:synthetic.http.duration.geo:filter(and(in("dt.entity.http_check",entitySelector("type(http_check),entityName(~"API Sample~")")),in("dt.entity.synthetic_location",entitySelector("type(synthetic_location),entityName(~"N. California~")")))):splitBy("dt.entity.http_check","dt.entity.synthetic_location"):avg:auto:sort(value(avg,descending)):limit(20)
value: 200
target: 0.75
- displayName: Annoying
op: lte
rawMetric:
query:
dynatrace:
metricSelector: builtin:synthetic.http.duration.geo:filter(and(in("dt.entity.http_check",entitySelector("type(http_check),entityName(~"API Sample~")")),in("dt.entity.synthetic_location",entitySelector("type(synthetic_location),entityName(~"N. California~")")))):splitBy("dt.entity.http_check","dt.entity.synthetic_location"):avg:auto:sort(value(avg,descending)):limit(20)
value: 300
target: 0.95

Metric specification from Dynatrace requires one field:

  • dynatrace.metricSelector – mandatory, string. You can try out your metricSelector in the Data Explorer tool. In the Custom chart area, click the Try it out button. Then, in the Data Explorer, select the Code tab:
Image 1: Data Explorer tool

Dynatrace metricSelector is a powerful instrument for specifying which metrics you want to read with the GET metric data points. By using metricSelector, you can transform the resulting set of data points. For more details, go to Metrics API - Metric Selector | Dynatrace documentation.

Querying the Dynatrace server

Nobl9 calls the Dynatrace server every minute to retrieve the raw data.

Get Metric Data Points | Dynatrace documentation

Metrics API - Metric Selector | Dynatrace documentation

Metrics API - Get Metrics | Dynatrace documentation

Agent metrics

Creating SLOs via Terraform

Creating agents via Terraform