Dynatrace
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).
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 enabled.
For details on how to get your token, refer to the Dynatrace API - Tokens and authentication | Dynatrace Documentation.
Adding Dynatrace as a Data Source in the UI
To add Dynatrace as a data source in Nobl9 using the Agent or Direct connection method, follow these steps:
- Navigate to Integrations > Sources.
- Click the
button.
- Click the relevant Source icon.
- 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:
- 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 abeta
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.
- The
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}>
Enter the Dynatrace Token (mandatory).
To use the Dynatrace API, you must provide an access token withmetrics.read
scope enabled. For more information, refer to the Authentication section above.
- 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 then object is assigned to projectdefault
. - Enter a Display Name.
You can enter a friendly name with spaces in this field. - Enter a Name.
The name is mandatory and can only contain lowercase, alphanumeric characters and dashes (for example,my-project-name
). This field is populated automatically when you enter a display name, but you can edit the result. - Enter a Description.
Here you can add details such as who is responsible for the integration (team/owner) and the purpose of creating it. - Customize 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
.
infoChanging the Query delay may affect your SLI data. For more details, check the Query delay documentation. - The default value in Dynatrace integration for Query delay is
- 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 Source. Check the Replay documentation for details.
- Entering a more extended Period might slow down the loading time when creating an SLO.
- The value must be a positive integer.
- Enter a Default Period for Historical Data Retrieval.
- It is the Period that will be used by the SLO connected to this data source.
- The value must be a positive integer or
0
. - By default, this value is set to 0. If you set it to
>0
, you will create an SLO with Replay.
- Click the Add Data Source
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: "" # secret
queryDelay:
unit: Minute # string, one of: Second || Minute
value: 720 # numeric, must be a number less than 1440 minutes (24 hours)
logCollectionEnabled: false # boolean, defaults to 'false'. Set to true if you'd like your source to collect logs. It's a beta functionality available only through direct release channel. Reach out to support@nobl9.com to activate it.
historicalDataRetrieval:
maxDuration:
value: 28
unit: Day # allowed values: Minute, Hour, Day
defaultDuration:
value: 7
unit: Day # allowed values: Minute, Hour, Day
Important Notes:
dynatraceToken
- a hash that can be generated in the Dynatrace UI. For more information, refer to the Authentication section.url
– string: interface URLDepending on the environment, the expected URL format is:
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}>
spec[n].historicalDataRetrieval
- refer to Replay Documentation | Nobl9 Documentation for more details.
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.
- 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 abeta
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.
- The
Add the URL to connect to your data source.
- Enter a Project.
- Enter a Name.
- Create a Description.
- In the Advanced Settings you can:
- Enter a Maximum Period for Historical Data Retrieval.
- Enter a Default Period for Historical Data Retrieval.
- Click the Add Data Source
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 # optional
project: dynatrace
spec:
sourceOf:
- Metrics
- Services
releaseChannel: beta # string, one of: beta || stable
queryDelay:
unit: Minute # string, one of: Second || Minute
value: 720 # numeric, must be a number less than 1440 minutes (24 hours)
dynatrace:
url: https://your-environment-id.live.dynatrace.com
historicalDataRetrieval:
maxDuration:
value: 28
unit: Day # allowed values: Minute, Hour, Day
defaultDuration:
value: 7
unit: Day # allowed values: Minute, Hour, Day
Important Notes
Agent specification from Dynatrace requires the following fields:
url
– string: interface URLspec[n].historicalDataRetrieval
- refer to Replay Documentation | Nobl9 Documentation for more details.
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}>
Environment ActiveGate:
<https://{your-activegate-domain}/e/{your-environment-id}>
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 enabled).
- Kubernetes
- Docker
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:latest
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"
If you use Docker, you can run the supplied Docker command to deploy the Agent. It will look something like this:
# DISCLAIMER: This Docker command contains only the fields necessary for the purpose of this demo.
# It is not a ready-to-apply command, and you will need to replace the placeholder values with your own values.
docker run -d --restart on-failure \
--name nobl9-agent-nobl9-dev-mydynatrace-dynatraceagent \
-e N9_CLIENT_ID="unique_client_id" \
-e N9_CLIENT_SECRET="unique_client_secret" \
# 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.
-e N9_METRICS_PORT=9090 \
-e DYNATRACE_TOKEN="<DYNATRACE_TOKEN>" \
nobl9/agent:latest
Creating SLOs with Dynatrace
Creating SLOs in the UI
Follow the instructions below to create your SLOs with Dynatrace in the UI:
Navigate to Service Level Objectives.
- Click the
button.
In step 1 of the SLO wizard, select the Service the SLO will be associated with.
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).
noteFor the Ratio Metric, you can choose the Data Count Method:
- For the Non-incremental method, we expect it to be the components of the sum.
- For the Incremental method, we expect the value of a metric to be the current sum of some numerator.
For more information, refer to the SLO Calculations Guide.
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.
In step 3, define a Time Window for the SLO.
In step 4, specify the Error Budget Calculation Method and your Objective(s).
In step 5, add a Name, Description, and other details about your SLO. You can also select Alert Policies and Labels on this screen.
When you’re done, click Create SLO.
SLOs using Dynatrace - YAML samples
- rawMetric
- countMetric
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
Here’s an example of Dynatrace using a countMetric
(Ratio metric):
apiVersion: n9/v1alpha
kind: SLO
metadata:
name: dynatrace-slo-ratio
displayName: Dynatrace Ratio
project: dynatrace
spec:
budgetingMethod: Occurrences
indicator:
metricSource:
kind: Agent
name: dynatrace
project: dynatrace
objectives:
- countMetrics:
good:
dynatrace:
metricSelector: >
builtin:synthetic.http.request."statusCode":filter(
and(in("dt.entity.http_check_step",entitySelector("type(http_check_step),
entityName(~"httpbin.org~")")),eq("Status code",SC_2xx),
in("dt.entity.synthetic_location",entitySelector("type(synthetic_location),
entityName(~"N. California~")")))):
splitBy("Status code","dt.entity.http_check_step","dt.entity.synthetic_location"):
count:auto:sort(value(avg,descending)):limit(20)
incremental: false
total:
dynatrace:
metricSelector: >
builtin:synthetic.http.request."statusCode":filter(
and(in("dt.entity.http_check_step",entitySelector("type(http_check_step),
entityName(~"httpbin.org~")")),in("dt.entity.synthetic_location",
entitySelector("type(synthetic_location),entityName(~"N. California~")")))):
splitBy("dt.entity.synthetic_location","dt.entity.http_check_step"):
count:auto:sort(value(avg,descending)):limit(20)
displayName: Enough
target: 0.5
value: 1
service: dynatrace-demo-service
timeWindows:
- count: 1
isRolling: true
period:
begin: "2021-05-05T10:39:55Z"
end: "2021-05-05T11:39:55Z"
unit: Hour
Metric specification from Dynatrace requires one field:
dynatrace.metricSelector
– mandatory, string. You can try out yourmetricSelector
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:

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.
Useful Links
Get Metric Data Points | Dynatrace Documentation
Metrics API - Metric Selector | Dynatrace Documentation
Metrics API - Get Metrics | Dynatrace Documentation
Agent Metrics | Nobl9 Documentation
Creating SLOs via Terraform | Nobl9 Terraform Documentation
Creating Agents via Terraform | Nobl9 Terraform Documentation