Keptn v1 reached EOL December 22, 2023. For more information see https://bit.ly/keptn
This documentation is for an older Keptn release. Please consider the newest one when working with the latest Keptn.

Best Practices

Set DT_CUSTOM_PROP before onboarding a service

The created tagging rules in Dynatrace expect the environment variable DT_CUSTOM_PROP for your onboarded service. Consequently, make sure to specify the environment variable for deployment in the Helm chart of the service you are going to onboard with the following value:

env:
- name: DT_CUSTOM_PROP
  value: "keptn_project={{ .Values.keptn.project }} keptn_service={{ .Values.keptn.service }} keptn_stage={{ .Values.keptn.stage }} keptn_deployment={{ .Values.keptn.deployment }}"

Automatic detection of Kubernetes labels

You can specify Kubernetes labels in the deployment definition of your application. Dynatrace automatically detects all labels attached to pods at application deployment time. All you have to do is grant sufficient privileges to the pods that allow for reading the metadata from the Kubernetes REST API endpoint.

  • Please follow the official Dynatrace documentation to grant viewer role to service accounts.

  • If you want to automatically detect the Kubernetes labels for Keptn, grant the viewer role to the keptn-default service account:

kubectl -n keptn create rolebinding default-view --clusterrole=view --serviceaccount=keptn:keptn-default

As a result, Dynatrace will add the recommended Kubernetes labels to the processes, e.g.:

Disabling frequent issue detection

Disable frequent issue detection

When using Keptn for automating operations, e.g., to trigger remediation actions to resolve a problem identified by Dynatrace, it is recommended to disable the Frequent Issue Detection within Dynatrace. If this feature is disabled, Dynatrace sends brand new alerts every time a problem is detected. To disable it, go to Settings > Anomaly Detection > Frequent Issue Detection, and toggle all switches found in this menu:

Disabling frequent issue detection

Create a process group naming rule

While it is not a technical requirement, we encourage you to set up a process group naming rule within Dynatrace for better visibility of services, e.g.:

Screenshot shows the applied rules in action

Dynatrace naming rule in action

To configure this rule, follow these steps:

  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: Keptn Processgroup Naming
    • Process group name format: {ProcessGroup:Environment:keptn_project}.{ProcessGroup:Environment:keptn_stage}.{ProcessGroup:Environment:keptn_service} [{ProcessGroup:Environment:keptn_deployment}]
    • Condition: keptn_deployment (Environment) > exists
  4. Click on Preview and Save.
Screenshot shows this rule definition.
Dynatrace naming rule

See Keptn events

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

Keptn events