Install and map Datadog resources in Service Catalog

Uses: Service Catalog Konnect API
Related Documentation
Incompatible with
on-prem
TL;DR

Install the Datadog integration in Konnect and authorize it using your API and app keys. Create a Service Catalog service and associate it with your Datadog resources to display metadata and enable event tracking.

Prerequisites

If you don’t have a Konnect account, you can get started quickly with our onboarding wizard.

  1. The following Konnect items are required to complete this tutorial:
    • Personal access token (PAT): Create a new personal access token by opening the Konnect PAT page and selecting Generate Token.
  2. Set the personal access token as an environment variable:

    export KONNECT_TOKEN='YOUR KONNECT TOKEN'
    

You need the Integration Admin role in Konnect to install and authorize Service Catalog integrations.

You’ll need Datadog API and application keys and must select your Datadog region to authenticate the integration. Your Datadog region must be in a format similar to US_5.

Additionally, you’ll need a Datadog monitor or dashboard to ingest in Konnect as resources.

Export your Datadog authentication credentials:

export DATADOG_API_KEY='YOUR-API-KEY'
export DATADOG_APPLICATION_KEY='YOUR-APP-KEY'
export DATADOG_REGION='YOUR-REGION'

Install and authorize the Datadog integration

Before you can ingest resources from Datadog, you must first install and authorize the Datadog integration.

First, install the Datadog integration:

 curl -X POST "https://us.api.konghq.com/v1/integration-instances" \
     -H "Authorization: Bearer $KONNECT_TOKEN" \
     --json '{
       "integration_name": "datadog",
       "name": "datadog",
       "display_name": "Datadog",
       "config": {
         "datadog_region": "'$DATADOG_REGION'",
         "datadog_webhook_name": "konnect-service-catalog"
       }
     }'

Export the ID of your Datadog integration:

export DATADOG_INTEGRATION_ID='YOUR-INTEGRATION-ID'

Next, authorize the Datadog integration with your Datadog API key and application key:

 curl -X POST "https://us.api.konghq.com/v1/integration-instances/$DATADOG_INTEGRATION_ID/auth-credential" \
     -H "Authorization: Bearer $KONNECT_TOKEN" \
     --json '{
       "type": "multi_key_auth",
       "config": {
         "headers": [
           {
             "name": "DD-API-KEY",
             "key": "'$DATADOG_API_KEY'"
           },
           {
             "name": "DD-APPLICATION-KEY",
             "key": "'$DATADOG_APPLICATION_KEY'"
           }
         ]
       }
     }'

Once authorized, monitor and dashboard resources from your Datadog account will be discoverable in the UI.

Create a service in Service Catalog

Create a service that you’ll map to your Datadog resources:

 curl -X POST "https://us.api.konghq.com/v1/catalog-services" \
     -H "Authorization: Bearer $KONNECT_TOKEN" \
     --json '{
       "name": "billing",
       "display_name": "Billing Service"
     }'

Export the service ID:

export DATADOG_SERVICE_ID='YOUR-SERVICE-ID'

List Datadog resources

Before you can map your Datadog resources to a service in Service Catalog, you first need to find the resources that are pulled in from Datadog:

 curl -X GET "https://us.api.konghq.com/v1/resources?filter%5Bintegration.name%5D=datadog" \
     -H "Authorization: Bearer $KONNECT_TOKEN"

You might need to manually sync your Datadog integration for resources to appear. From the Konnect UI by navigating to the Datadog integration you just installed and selecting Sync Now from the Actions dropdown menu.

Export the resource ID you want to map to the service:

export DATADOG_RESOURCE_ID='YOUR-RESOURCE-ID'

Map resources to a service

Now, you can map the Datadog resource to the service:

 curl -X POST "https://us.api.konghq.com/v1/resource-mappings" \
     -H "Authorization: Bearer $KONNECT_TOKEN" \
     --json '{
       "service": "billing",
       "resource": "'$DATADOG_RESOURCE_ID'"
     }'

Validate the mapping

To confirm that the Datadog resource is now mapped to the intended service, list the service’s mapped resources:

 curl -X GET "https://us.api.konghq.com/v1/catalog-services/$DATADOG_SERVICE_ID/resources" \
     -H "Authorization: Bearer $KONNECT_TOKEN"\
     -H "Accept: application/json"
Something wrong?

Help us make these docs great!

Kong Developer docs are open source. If you find these useful and want to make them better, contribute today!