For the complete documentation index, see llms.txt. This page is also available as Markdown.

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


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:

  1. In Health Sources, select Add. The Add New Health Source settings appear.

    Add New Health Source dialog
  2. In Select health source type, select Datadog.

  3. In Health Source Name, enter a name for the health source.

  4. Under Connect Health Source, select Select Connector.

  5. In Connector settings, choose an existing connector or select New Connector.

    Select or create a Datadog connector
  6. Select Apply Selected. The connector is added to the health source.

  7. In Select Feature, select the Datadog feature to use. You can choose Cloud Metrics or Cloud Logs.

    Select Cloud Metrics or Cloud Logs
  8. 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.

Select Datadog dashboards for Cloud Metrics

Perform the following steps to finish Cloud Metrics configuration:

  1. 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.

  2. Select Next. The Customize Health Source settings appear.

  3. 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
  4. 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 * 100

  • Memory: 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:

  1. Select Map Queries to Harness Services.

    Map Datadog log queries to Harness services
  2. Enter a name for the query in Name your Query.

  3. In Log Indexes, select a log index from the list.

  4. 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.

  5. Select Submit. The health source is displayed in the AI Verify (v1) step.


Troubleshooting

Add health source is not available

Confirm that the service and environment are configured as fixed values. The Datadog health source option described in this topic is available only in that configuration.

Connector list is empty or Apply Selected fails

Create or repair a Datadog connector first. Go to Connect to monitoring and logging systems to add Datadog as a verification provider, then return to the health source wizard.

Manual formula query returns unexpected values

Confirm that each alphabetical variable maps to the intended Datadog query, that only one formula appears at the end of the string, and that separators use ; between queries and the formula. Validate the query in Datadog before you save it in Harness.


Next steps

Last updated

Was this helpful?