In this use case, you'll
Below is an example of what your Argo CD dashboard could look like.
The main benefits are data normalization, being tool-agnostic, and not relying on specific tools. As a result, Dynatrace Dashboards, Apps, and Workflows can build on SDLC events with well-defined properties rather than tool-specific details.
This tutorial is intended for platform engineers who manage the Internal Development Platform (IDP), including Argo CD, in GitOps-based deployments.
In this tutorial, you'll learn how to
If you prefer, you could follow the Argo CD tutorial directly on GitHub.
Install Dynatrace Configuration as Code via Monaco
Create an OAuth client for the Dynatrace Monaco CLI with the following permissions
app-engine:apps:run
openpipeline:configurations:read
openpipeline:configurations:write
document:documents:write
document:documents:read
Store the retrieved client ID and secret as separate environment variables.
$env:OAUTH_CLIENT_ID='<YOUR_CLIENT_ID>'
$env:OAUTH_CLIENT_SECRET='<YOUR_CLIENT_SECRET>'
Clone the Dynatrace configuration as code sample repository and go to argocd_observability
directory.
git clone https://github.com/Dynatrace/dynatrace-configuration-as-code-samples.gitcd dynatrace-configuration-as-code-samples/argocd_observability
Edit the manifest.yaml
by exchanging your environment ID <YOUR-DT-ENV-ID>
placeholder with your Dynatrace environment ID at the name property and within the URL of the value property.
manifestVersion: 1.0projects:- name: pipeline_observabilityenvironmentGroups:- name: groupenvironments:- name: <YOUR-DT-ENV-ID>url:type: valuevalue: https://<YOUR-DT-ENV-ID>.apps.dynatrace.comauth:oAuth:clientId:name: OAUTH_CLIENT_IDclientSecret:name: OAUTH_CLIENT_SECRET
These steps modify the OpenPipeline configuration for SDLC events. If your OpenPipeline configuration contains only default/built-in values, you can directly apply the Monaco configuration. If you have any custom ingest sources, dynamic routes, or pipelines, you'll first need to download your configuration and manually merge it into the Monaco configuration.
Step 3 will indicate if a configuration merge is needed or if you can apply the provided configuration directly.
Go to Settings > Process and contextualize > OpenPipeline > Events > Software development lifecycle.
Check the Ingest sources, Dynamic routing, and Pipelines.
If the answer to one of those questions is "yes", follow the steps below. Otherwise, skip ahead to step 4.
Download the OpenPipeline configuration.
monaco download -e <YOUR-DT-ENV-ID> --only-openpipeline
Open the following files:
download_<DATE>_<NUMBER>/project/openpipline/events.sdlc.json
.pipeline_observability/openpipline/events.sdlc.argocd.json
.Merge the contents of events.sdlc.json
into events.sdlc.argocd.json
, and then save the file.
Apply the Monaco configuration.
The configuration consists of
Run this command to apply the provided Monaco configuration:
monaco deploy manifest.yaml
To generate an access token:
You can only access your token once upon creation. You can't reveal it afterward.
Select these scopes:
openpipeline.events_sdlc
)openpipeline.events_sdlc.custom
)Argo CD notifications provide a flexible way to alert users about essential changes in the state of their applications managed by Argo CD. To configure the Argo CD notifications, you need to create a notification secret, apply the configuration, and subscribe applications to notifications.
Create notification secret.
Update the argocd-notifications-secret
with:
apiVersion: v1kind: Secretmetadata:name: argocd-notifications-secretstringData:dt-base-url: https://{your-environment-id}.live.dynatrace.comdt-access-token: <YOUR-ACCESS-TOKEN>
Apply the configuration.
kubectl apply -f <secret_file_name>.yaml -n argocd
Create a notification template and trigger.
If you don't have any notification configurations, create a new configuration map called argocd-notification-cm
as shown below. Otherwise, extend your config map configuration by adding the example's service, template, and trigger sections.
apiVersion: v1kind: ConfigMapmetadata:name: argocd-notifications-cmdata:service.webhook.dynatrace-webhook: |url: $dt-base-urlheaders:- name: "Authorization"value: Api-Token $dt-access-token- name: "Content-Type"value: "application/json; charset=utf-8"template.dynatrace-webhook-template: |webhook:dynatrace-webhook:method: POSTpath: /platform/ingest/custom/events.sdlc/argocdbody: |{"app": {{toJson .app}}}trigger.dynatrace-webhook-trigger: |- when: app.status.operationState.phase in ['Succeeded'] and app.status.health.status in ['Healthy', 'Degraded']send: [dynatrace-webhook-template]- when: app.status.operationState.phase in ['Failed', 'Error']send: [dynatrace-webhook-template]- when: app.status.operationState.phase in ['Running']send: [dynatrace-webhook-template]
Here is an explanation for the naming in the configuration.
dynatrace-webhook
is the name of the service, $dt-access-token
refers to the Dynatrace access token, and $dt-base-url
is a reference to the Dynatrace event ingest endpoint stored in the argocd-notifications-secret secret
.dynatrace-webhook-template
is the template's name, and dynatrace-webhook
refers to the service created above.dynatrace-webhook-trigger
is the trigger's name, and dynatrace-webhook-template
refers to the template created above.Apply the configuration with this command.
kubectl apply -f <config_map_file_name>.yaml -n argocd
Subscribe applications to notifications.
Modify the annotations of the Argo CD application by using either the Argo CD UI or the Argo CD application definition with the following annotations:
apiVersion: argoproj.io/v1alpha1kind: Applicationmetadata:annotations:notifications.argoproj.io/subscribe.dynatrace-webhook-trigger.dynatrace-webhook: ""
The added notifications.argoproj.io
notification annotation subscribes the Argo CD application to the notification setup you created above.
Argo CD exposes different sets of Prometheus metrics for different services. Configure your Argo CD services to expose this information so that it can be collected by Dynatrace. You can use either Dynatrace ActiveGate, which is installed on the Kubernetes cluster that hosts Argo CD, or the Dynatrace Collector.
To use Dynatrace ActiveGate
Enable Prometheus metrics monitoring.
In your Argo CD installation namespace, add the following two annotations for each of the services listed in the table below.
Replace {METRICS_PORT}
with the corresponding port number.
metrics.dynatrace.com/port: {METRICS_PORT}metrics.dynatrace.com/scrape: 'true'
View the histogram data ingest by going to Settings > Metrics > Histograms. The Ingest complete explicit bucket histograms setting that you need is automatically turned on.
Now that you've successfully configured Argo CD and Dynatrace, you can use Dashboards and SDLC events to observe your Argo CD deployments.
In Dynatrace, open the ArgoCD Application Lifecycle dashboard to
Leverage those insights for the following improvement areas:
Improved performance: Optimizing syncs can reduce the time it takes to deploy changes, making your deployment process more efficient. Efficient syncs can also help better utilize resources, reducing the load on your infrastructure.
Enhanced Reliability: Optimizing syncs can minimize the chances of errors during deployment, leading to more stable and reliable releases. Ensuring that syncs are optimized can help maintain consistency across different environments.
Regularly review your Argo CD sync operations and adjust the configuration to ensure they're optimized for performance.
In Dynatrace, adjust the timeframe of the ArgoCD Application Lifecycle dashboards to monitor the long-term impact of your improvements.
We highly value your insights on Argo CD observability. Your feedback is crucial in helping us enhance our tools and services. Visit the Dynatrace Community page to share your experiences, suggestions, and ideas directly in Feedback channel for CI/CD Pipeline Observability.