Setup Dynatrace

In order to evaluate the quality gates and allow self-healing in production, we have to set up monitoring to provide the needed data.

Setup Dynatrace

  1. Bring your Dynatrace SaaS or Dynatrace-managed tenant

    If you don’t have a Dynatrace tenant, sign up for a free trial or a developer account.

  2. Create a Dynatrace API Token

    Log in to your Dynatrace tenant, and go to Settings > Integration > Dynatrace API. Then, create a new API token with the following permissions:

    • Access problem and event feed, metrics and topology
    • Access logs
    • Configure maintenance windows
    • Read configuration
    • Write configuration
    • Capture request data
    • Real user monitoring JavaScript tag management
    Dynatrace API Token
  3. Create a Dynatrace PaaS Token

    In your Dynatrace tenant, go to Settings > Integration > Platform as a Service, and create a new PaaS Token.

  4. Clone the install repository and setup your credentials by executing the following steps:

    git clone --branch 0.2.2 --single-branch
    cd installer/scripts

    When the script asks for your Dynatrace tenant, please enter your tenant according to the appropriate pattern:

    • Dynatrace SaaS tenant: {your-environment-id}
    • Dynatrace-managed tenant: {your-domain}/e/{your-environment-id}
  5. Execute the installation script


    When this script is finished, the Dynatrace OneAgent and the dynatrace-service are deployed in your cluster. Execute the following command to verify the deployment of the dynatrace-service.

    kubectl get ksvc dynatrace-service -n keptn
    NAME                DOMAIN                                      LATESTCREATED             LATESTREADY               READY
    dynatrace-service   dynatrace-service.keptn.svc.cluster.local   dynatrace-service-26sm4   dynatrace-service-26sm4   True

Note 1: To monitor the services that are already onboarded in the dev, staging, and production namespace, make sure to restart the pods. If you defined different environments in your shipyard file, please adjust the values accordingly.

kubectl delete pods --all --namespace=sockshop-dev
kubectl delete pods --all --namespace=sockshop-staging
kubectl delete pods --all --namespace=sockshop-production

Note 2: If the nodes in your cluster run on Container-Optimized OS (cos), make sure to follow the instructions for setting up the Dynatrace OneAgent Operator. This means that after the initial setup with, which is a step below, the cr.yml has to be edited and applied again. In addition, all pods have to be restarted.

See keptn events in Dynatrace

The Dynatrace service will take care of pushing events of the keptn workflow to the artifacts that have been onboarded with keptn. For example, the deployment as well as custom infos like starting and finishing of tests will appear in the details screen of your services in your Dynatrace tenant.

keptn events

Upgrade Dynatrace monitoring for keptn 0.2.2

Due to a change of the data stored in the dynatrace secret in the keptn namespace, it is necessary to update the secret according to the following steps: 1. Prepare the Dynatrace URI: - Dynatrace SaaS tenant: {your-environment-id} - Dynatrace-managed tenant: {your-domain}/e/{your-environment-id} 1. Update the property DT_TENANT based on the Dynatrace URI. Please note that the value has to be base64 encoded. console kubectl edit secret dynatrace -n keptn

(Optional) Create process group naming rule in Dynatrace

  1. Create a naming rule for process groups

    1. Go to Settings, Process and containers, and click on Process group naming.
    2. Create a new process group naming rule with Add new rule.
    3. Edit that rule:
      • Rule name: Container.Namespace
      • Process group name format: {ProcessGroup:KubernetesContainerName}.{ProcessGroup:KubernetesNamespace}
      • Condition: Kubernetes namespace> exits
    4. Click on Preview and Save.

    Screenshot shows this rule definition.

    Dynatrace naming rule