Set up Tracing on an Azure Pipeline

CI Visibility is not available in the selected site () at this time.

Compatibility

  • Custom tags and metrics at runtime: Configure custom tags and metrics at runtime

  • Custom pre-defined tags: Set custom tags for all generated pipeline, stage, and job spans.

Configure the Datadog integration

The Datadog integration for Azure Pipelines works by using service hooks to send data to Datadog.

  1. Install the Datadog CI Visibility extension from the Azure Marketplace.

  2. For each project, go to Project settings > Service hooks in Azure DevOps and select the green plus (+) icon to create a subscription.

  3. Create a new subscription to the Datadog CI Visibility service for each of the following webhook types:

    • Run state changed
    • Run stage state changed
    • Run job state changed
  4. Click Next to continue to the next step and set the following:

  5. Click Finish.

All 3 supported types of events are required and must be enabled individually. Not enabling one or more events results in an an incomplete installation, leading to unexpected behavior in Datadog.

Configuring multiple projects in bulk

If you want to enable the hooks for many or all your Azure projects, Datadog provides a script to help you do it through the Azure API.

To run the script, you need:

  • An Azure DevOps username
  • An Azure DevOps API Token
  • An Azure DevOps organization name

The script only needs python3 and the requests package. For more info, run:

./service_hooks.py --help

The script supports environment variables DD_API_KEY and DD_SITE, and flag parameters --dd-api-key and --dd-site.

Example for enabling the hooks in all projects:

./service_hooks.py \
    --dd-api-key ******************** \
    --az-user "John Doe" \
    --az-token ********************** \
    --az-org datadoghq \
    --threads 4

Example for enabling the hooks in specified projects:

./service_hooks.py \
    --dd-api-key ******************** \
    --az-user "John Doe" \
    --az-token ********************** \
    --az-org datadoghq \
    projectName1 projectName2

Set custom tags

To set custom tags for all the pipeline and job spans generated by the integration, add to the Service hook URL a URL-encoded query parameter tags, with key:value pairs separated by commas. If a key:value pair contains any commas, surround it with quotes. For example, to add key1:value1,"key2: value with , comma",key3:value3, append the following string to the Service hook URL:

?tags=key1%3Avalue1%2C%22key2%3A+value+with+%2C+comma%22%2Ckey3%3Avalue3

Visualize pipeline data in Datadog

The Pipelines and Pipeline Executions pages populate with data after the workflows finish.

Note: The Pipelines page shows data for only the default branch of each repository.

Further reading