Datadog
Add Datadog as a Continuous Verification health source for metrics or logs
This topic shows how to add Datadog as a health source for Continuous Verification (CV) in Harness. A health source maps a Harness service to the service in a deployment environment monitored by an application performance monitoring (APM) or logging tool.
What you will learn from this topic
How to meet the prerequisites for a Datadog health source
How to configure Cloud Metrics, including formulas and common queries
How to configure Cloud Logs and map queries to Harness services
Before you begin
Confirm the following before you add a Datadog health source:
CV setup: Complete the shared Continuous Verification setup for your pipeline. Go to Configure CV to configure verification.
Datadog connector: Create a Datadog connector in Harness. Go to Connect to monitoring and logging systems to add Datadog as a verification provider.
Fixed service and environment: The health source option described in this topic is available only when you configure the service and environment as fixed values.
Add Datadog as a health source
Perform the following steps to add Datadog as a health source:
In Health Sources, select Add. The Add New Health Source settings appear.

Add New Health Source dialog In Select health source type, select Datadog.
In Health Source Name, enter a name for the health source.
Under Connect Health Source, select Select Connector.
In Connector settings, choose an existing connector or select New Connector.

Select or create a Datadog connector Select Apply Selected. The connector is added to the health source.
In Select Feature, select the Datadog feature to use. You can choose Cloud Metrics or Cloud Logs.

Select Cloud Metrics or Cloud Logs Select Next.
The settings in Customize Health Source depend on the feature you selected.
Cloud Metrics
If you select Cloud Metrics, the Select Dashboards settings appear and display a list of Datadog dashboards.

Perform the following steps to finish Cloud Metrics configuration:
Select the dashboards you want to use. If you do not have preexisting dashboards, or you do not want to select the ones displayed, select Manually input query.
Select Next. The Customize Health Source settings appear.
Select a query from the options displayed on the left side of the settings panel. The specification of the selected query populates the fields under Query Specifications.

Query specifications for a selected Datadog query Select Submit. The health source is displayed in the AI Verify (v1) step.
Configure Datadog formulas as Harness queries
In manual query mode, the Datadog metrics health source supports formulas. These formulas follow this format:
Query a ; Query b ; Formula using a, b
Query a:
"Query-with-a"Query b:
"Query-with-b"The formula is
"(a/b) * 100 - 5"
The following example illustrates the pattern:
In this example, a and b represent the respective queries:
a=kubernetes.memory.usage{cluster-name:chi-play}b=kubernetes.memory.total{cluster-name:chi-play}
You can use multiple queries represented by alphabetical variables (for example, a, b, c) in the final formula, but only one formula is allowed per query.
Commonly used Datadog queries
The following examples show common Datadog query patterns. Validate each query against your Datadog account before you use it in production.
Performance
P90:
synthetics.http.response.time.distrib{availability_zone:*}, pod=~"harness-dummy-.*"}[5m])) by (le))P50:
synthetics.http.response.time.distrib{availability_zone:*}
API
5xx response:
sum:synthetics.http.response{status_code_class:5xx}.as_rate() , sum:synthetics.http.response{status_code:502}.as_rate()4xx response:
sum:synthetics.http.response{status_code_class:4xx}.as_rate() , sum:synthetics.http.response{status_code:401}.as_rate()
Infrastructure
CPU:
per_minute(sum:container.cpu.usage{cluster_name:del-play-* cluster-location:us-*}) , system.cpu.num_cores{*} ; Final Value: a/b * 100Memory:
per_minute(sum:container.cpu.usage{cluster_name:del-**, cluster-location:us-**})
Cloud Logs
Select Cloud Logs, then select Next. The Customize Health Source settings appear.
You can customize the metrics to map the Harness service to the monitored environment in Query Specifications and Mapping settings.
Perform the following steps to map log queries:
Select Map Queries to Harness Services.

Map Datadog log queries to Harness services Enter a name for the query in Name your Query.
In Log Indexes, select a log index from the list.
In Service Instance Identifier, select the path of the service instance. Any tag used in a metric or log can be a service instance identifier. It should correspond to instances that are running. The list contains all tags returned by data through the API. Go to List tags by metric name to review Datadog tag APIs.
Select Submit. The health source is displayed in the AI Verify (v1) step.
Troubleshooting
Next steps
Configure CV: Finish Continuous Verification setup for the pipeline.
Connect to monitoring and logging systems: Create or update the Datadog connector.
List tags by metric name: Review Datadog tag APIs used for service instance identifiers.
Last updated
Was this helpful?