Skip to main content

Datadog

Our Datadog integration allows you to import monitors (also known as alerts), slos, and services from your Datadog account into Port, according to your mapping and definition.

Common use cases

  • Map monitors, slos and services in your Datadog workspace environment.
  • Watch for object changes (create/update/delete) in real-time, and automatically apply the changes to your entities in Port.
  • Create/delete Datadog objects using self-service actions.

Prerequisites

To install the integration, you need a Kubernetes cluster that the integration's container chart will be deployed to.

Please make sure that you have kubectl and helm installed on your machine, and that your kubectl CLI is connected to the Kubernetes cluster where you plan to install the integration.

Troubleshooting

If you are having trouble installing this integration, please refer to these troubleshooting steps.

Installation

Choose one of the following installation methods:

Using this installation option means that the integration will be able to update Port in real time using webhooks.

This table summarizes the available parameters for the installation. Set them as you wish in the script below, then copy it and run it in your terminal:

ParameterDescriptionExampleRequired
port.clientIdYour port client id
port.clientSecretYour port client secret
port.baseUrlYour Port API URL - https://api.getport.io for EU, https://api.us.getport.io for US
integration.secrets.datadogApiKeyDatadog API key, docs can be found here
integration.secrets.datadogApplicationKeyDatadog application key, docs can be found here
integration.config.datadogBaseUrlThe base Datadog host. Defaults to https://api.datadoghq.com. If in EU, use https://api.datadoghq.eu
integration.secrets.datadogWebhookTokenDatadog webhook token. Learn more
integration.config.appHostThe host of the Port Ocean app. Used to set up the integration endpoint as the target for webhooks created in Datadoghttps://my-ocean-integration.com

Advanced configuration

ParameterDescription
integration.eventListener.typeThe event listener type. Read more about event listeners
integration.typeThe integration to be installed
scheduledResyncIntervalThe number of minutes between each resync. When not set the integration will resync for each event listener resync event. Read more about scheduledResyncInterval
initializePortResourcesDefault true, When set to true the integration will create default blueprints and the port App config Mapping. Read more about initializePortResources

To install the integration using Helm, run the following command:

helm repo add --force-update port-labs https://port-labs.github.io/helm-charts
helm upgrade --install my-datadog-integration port-labs/port-ocean \
--set port.clientId="PORT_CLIENT_ID" \
--set port.clientSecret="PORT_CLIENT_SECRET" \
--set port.baseUrl="https://api.getport.io" \
--set initializePortResources=true \
--set scheduledResyncInterval=60 \
--set integration.identifier="my-datadog-integration" \
--set integration.type="datadog" \
--set integration.eventListener.type="POLLING" \
--set integration.config.datadogBaseUrl="https://api.datadoghq.com" \
--set integration.secrets.datadogApiKey="<your-datadog-api-key>" \
--set integration.secrets.datadogApplicationKey="<your-datadog-application-key>"
Selecting a Port API URL by account region

The baseUrl, port_region, port.baseUrl, portBaseUrl, port_base_url and OCEAN__PORT__BASE_URL parameters are used to select which instance or Port API will be used.

Port exposes two API instances, one for the EU region of Port, and one for the US region of Port.

Advanced integration configuration

For advanced configuration such as proxies or self-signed certificates, click here.

Ingesting Datadog objects

The Datadog integration uses a YAML configuration to describe the process of loading data into the developer portal.

Here is an example snippet from the config which demonstrates the process for getting service data from Datadog:

createMissingRelatedEntities: true
deleteDependentEntities: true
resources:
- kind: service
selector:
query: 'true'
port:
entity:
mappings:
blueprint: '"datadogService"'
identifier: .attributes.schema."dd-service"
title: .attributes.schema."dd-service"
properties:
application: .attributes.schema.application
languages: .attributes.schema.languages
description: .attributes.schema.description
tags: .attributes.schema.tags
type: .attributes.schema.type
links: .attributes.schema.links | map(.url)
owners: '[.attributes.schema.contacts[] | select(.type == "email") | .contact]'

The integration makes use of the JQ JSON processor to select, modify, concatenate, transform and perform other operations on existing fields and values from Datadog's API events.

Additional parameters

In the example above, two additional parameters are used:
createMissingRelatedEntities - used to enable the creation of missing related entities in Port. This is useful when you want to create an entity and its related entities in one call, or if you want to create an entity whose related entity does not exist yet.

deleteDependentEntities - used to enable deletion of dependent Port entities. This is useful when you have two blueprints with a required relation, and the target entity in the relation should be deleted. In this scenario, the delete operation will fail if this parameter is set to false. If set to true, the source entity will be deleted as well.

Configuration structure

The integration configuration determines which resources will be queried from Datadog, and which entities and properties will be created in Port.

Supported resources (Kind)

The following resources can be used to map data from Datadog, it is possible to reference any field that appears in the API responses linked below for the mapping configuration.

  • The root key of the integration configuration is the resources key:

    resources:
    - kind: service
    selector:
    ...
  • The kind key is a specifier for a Datadog object:

      resources:
    - kind: service
    selector:
    ...
  • The selector and the query keys allow you to filter which objects of the specified kind will be ingested into your software catalog:

    resources:
    - kind: service
    selector:
    query: "true" # JQ boolean expression. If evaluated to false - this object will be skipped.
    port:
  • The port, entity and the mappings keys are used to map the Datadog object fields to Port entities. To create multiple mappings of the same kind, you can add another item in the resources array;

    resources:
    - kind: service
    selector:
    query: "true"
    port:
    entity:
    mappings: # Mappings between one Datadog object to a Port entity. Each value is a JQ query.
    blueprint: '"datadogService"'
    identifier: .attributes.schema."dd-service"
    title: .attributes.schema."dd-service"
    properties:
    application: .attributes.schema.application
    languages: .attributes.schema.languages
    description: .attributes.schema.description
    tags: .attributes.schema.tags
    type: .attributes.schema.type
    links: .attributes.schema.links | map(.url)
    owners: '[.attributes.schema.contacts[] | select(.type == "email") | .contact]'
    - kind: service # In this instance project is mapped again with a different filter
    selector:
    query: '.name == "MyServiceName"'
    port:
    entity:
    mappings: ...
Blueprint key

Note the value of the blueprint key - if you want to use a hardcoded string, you need to encapsulate it in 2 sets of quotes, for example use a pair of single-quotes (') and then another pair of double-quotes (")

Ingest data into Port

To ingest Datadog objects using the integration configuration, you can follow the steps below:

  1. Go to the DevPortal Builder page.
  2. Select a blueprint you want to ingest using Datadog.
  3. Choose the Ingest Data option from the menu.
  4. Click on + Data source at the top right corner
  5. Select Datadog under the APM & Alerting providers category.
  6. Modify the configuration according to your needs.
  7. Click Resync.

Examples

Examples of blueprints and the relevant integration configurations:

Monitor

Monitor blueprint
{
"identifier": "datadogMonitor",
"description": "This blueprint represents a datadog monitor",
"title": "Datadog Monitor",
"icon": "Datadog",
"schema": {
"properties": {
"monitorType": {
"type": "string",
"title": "Monitor Type"
},
"tags": {
"type": "array",
"title": "Tags"
},
"overallState": {
"type": "string",
"title": "Overall state",
"enum": ["Alert", "Ignored", "No Data", "OK", "Skipped", "Unknown", "Warn"],
"enumColors": {
"Alert": "red",
"Ignored": "darkGray",
"No Data": "lightGray",
"OK": "green",
"Skipped": "yellow",
"Unknown": "purple",
"Warn": "orange"
}
},
"priority": {
"type": "string",
"title": "Priority"
},
"thresholds": {
"type": "object",
"title": "Thresholds"
},
"createdBy": {
"type": "string",
"title": "Creator"
},
"createdAt": {
"title": "Created At",
"type": "string",
"format": "date-time"
},
"updatedAt": {
"title": "Updated At",
"type": "string",
"format": "date-time"
}
},
"required": []
},
"mirrorProperties": {},
"calculationProperties": {},
"relations": {}
}
Integration configuration
createMissingRelatedEntities: true
deleteDependentEntities: true
resources:
- kind: monitor
selector:
query: 'true'
port:
entity:
mappings:
blueprint: '"datadogMonitor"'
identifier: .id | tostring
title: .name
properties:
tags: .tags
monitorType: .type
overallState: .overall_state
thresholds: .thresholds
priority: .priority
createdBy: .creator.email
createdAt: .created
updatedAt: .modified

Service

Service blueprint
{
"identifier": "datadogService",
"description": "This blueprint represents a Datadog service",
"title": "Datadog Service",
"icon": "Datadog",
"schema": {
"properties": {
"application": {
"title": "Application",
"type": "string"
},
"description": {
"title": "Description",
"type": "string"
},
"tags": {
"type": "array",
"items": {
"type": "string"
},
"title": "Tags"
},
"languages": {
"items": {
"type": "string"
},
"title": "Languages",
"type": "array"
},
"type": {
"title": "Type",
"type": "string",
"enum": [
"web",
"db",
"custom",
"cache",
"function",
"browser",
"mobile"
],
"enumColors": {
"web": "lightGray",
"db": "lightGray",
"custom": "lightGray",
"cache": "lightGray",
"function": "lightGray",
"browser": "lightGray",
"mobile": "lightGray"
}
},
"owners": {
"type": "array",
"title": "Service Owners",
"items": {
"type": "string"
}
},
"links": {
"title": "Service Links",
"type": "array",
"description": "Links to external resources and repositories",
"items": {
"type": "string",
"format": "url"
}
}
},
"required": []
},
"mirrorProperties": {},
"calculationProperties": {},
"aggregationProperties": {},
"relations": {}
}
Integration configuration
createMissingRelatedEntities: true
deleteDependentEntities: true
resources:
- kind: service
selector:
query: 'true'
port:
entity:
mappings:
blueprint: '"datadogService"'
identifier: .attributes.schema."dd-service"
title: .attributes.schema."dd-service"
properties:
application: .attributes.schema.application
languages: .attributes.schema.languages
description: .attributes.schema.description
tags: .attributes.schema.tags
type: .attributes.schema.type
links: .attributes.schema.links | map(.url)
owners: '[.attributes.schema.contacts[] | select(.type == "email") | .contact]'

SLO

SLO blueprint
{
"identifier": "datadogSlo",
"description": "This blueprint represents a datadog SLO",
"title": "Datadog SLO",
"icon": "Datadog",
"schema": {
"properties": {
"tags": {
"type": "array",
"title": "Tags"
},
"sloType": {
"title": "Type",
"type": "string"
},
"description": {
"title": "Description",
"type": "string"
},
"warningThreshold": {
"title": "Warning Threshold",
"type": "string"
},
"targetThreshold": {
"title": "Target Threshold",
"type": "string"
},
"createdAt": {
"title": "Created At",
"type": "string",
"format": "date-time"
},
"updatedAt": {
"title": "Updated At",
"type": "string",
"format": "date-time"
},
"createdBy": {
"title": "Creator",
"type": "string"
}
},
"required": []
},
"mirrorProperties": {},
"calculationProperties": {},
"relations": {
"monitors": {
"target": "datadogMonitor",
"title": "SLO Monitors",
"description": "The monitors tracking this SLO",
"required": false,
"many": true
},
"services": {
"target": "datadogService",
"title": "Services",
"description": "The services tracked by this SLO",
"required": false,
"many": true
}
}
}
Integration configuration
createMissingRelatedEntities: true
deleteDependentEntities: true
resources:
- kind: slo
selector:
query: 'true'
port:
entity:
mappings:
blueprint: '"datadogSlo"'
identifier: .id | tostring
title: .name
properties:
tags: .tags
sloType: .type
description: .description
warningThreshold: .warning_threshold
targetThreshold: .target_threshold
createdBy: .creator.email
createdAt: .created_at | todate
updatedAt: .modified_at | todate
relations:
monitors: .monitor_ids | map(tostring)
services: '.monitor_tags + .tags | map(select(startswith("service:"))) | unique | map(split(":")[1])'

Let's Test It

This section includes a sample response data from Datadog. In addition, it includes the entity created from the resync event based on the Ocean configuration provided in the previous section.

Payload

Here is an example of the payload structure from Datadog:

Monitor response data
{
"id":15173866,
"org_id":1000147697,
"type":"query alert",
"name":"A change @webhook-PORT",
"message":"A change has happened",
"tags":[
"app:webserver"
],
"query":"change(avg(last_5m),last_1h):avg:datadog.agent.running{local} by {version,host} > 40",
"options":{
"thresholds":{
"critical":40.0,
"warning":30.0
},
"notify_audit":false,
"include_tags":true,
"new_group_delay":60,
"notify_no_data":false,
"timeout_h":0,
"silenced":{

}
},
"multi":true,
"created_at":1706707941000,
"created":"2024-01-31T13:32:21.270116+00:00",
"modified":"2024-02-02T16:31:40.516062+00:00",
"deleted":"None"[
"REDACTED"
],
"restricted_roles":"None"[
"REDACTED"
],
"priority":5,
"overall_state_modified":"2024-03-08T20:52:46+00:00",
"overall_state":"No Data",
"creator":{
"name":"John Doe",
"email":"john.doe@gmail.com",
"handle":"john.doe@gmail.com",
"id":1001199545
},
"matching_downtimes":[

]
}
Service response data
{
"type":"service-definition",
"id":"04fbab48-a233-4592-8c53-d1bfe282e6c3",
"attributes":{
"meta":{
"last-modified-time":"2024-05-29T10:31:06.833444245Z",
"github-html-url":"",
"ingestion-source":"api",
"origin":"unknown",
"origin-detail":"",
"warnings":[
{
"keyword-location":"/properties/integrations/properties/opsgenie/properties/service-url/pattern",
"instance-location":"/integrations/opsgenie/service-url",
"message":"does not match pattern '^(https?://)?[a-zA-Z\\\\d_\\\\-.]+\\\\.opsgenie\\\\.com/service/([a-zA-Z\\\\d_\\\\-]+)/?$'"
},
{
"keyword-location":"/properties/integrations/properties/pagerduty/properties/service-url/pattern",
"instance-location":"/integrations/pagerduty/service-url",
"message":"does not match pattern '^(https?://)?[a-zA-Z\\\\d_\\\\-.]+\\\\.pagerduty\\\\.com/service-directory/(P[a-zA-Z\\\\d_\\\\-]+)/?$'"
}
],
"ingested-schema-version":"v2.1"
},
"schema":{
"schema-version":"v2.2",
"dd-service":"inventory-management",
"team":"Inventory Management Team",
"application":"Inventory System",
"tier":"Tier 1",
"description":"Service for managing product inventory and stock levels.",
"lifecycle":"production",
"contacts":[
{
"name":"Inventory Team",
"type":"email",
"contact":"inventory-team@example.com"
},
{
"name":"Warehouse Support",
"type":"email",
"contact":"warehouse-support@example.com"
}
],
"links":[
{
"name":"Repository",
"type":"repo",
"provider":"GitHub",
"url":"https://github.com/example/inventory-service"
},
{
"name":"Runbook",
"type":"runbook",
"provider":"Confluence",
"url":"https://wiki.example.com/runbooks/inventory-service"
}
],
"tags":[
"inventory",
"stock"
],
"integrations":{
"pagerduty":{
"service-url":"https://pagerduty.com/services/inventory"
},
"opsgenie":{
"service-url":"https://opsgenie.com/services/inventory",
"region":"US"
}
},
"extensions":{
"qui_6":{

}
}
}
}
}
SLO response data
{
"id":"b6869ae6189d59baa421feb8b437fe9e",
"name":"Availability SLO for shopping-cart service",
"tags":[
"service:shopping-cart",
"env:none"
],
"monitor_tags":[

],
"thresholds":[
{
"timeframe":"7d",
"target":99.9,
"target_display":"99.9"
}
],
"type":"monitor",
"type_id":0,
"description":"This SLO tracks the availability of the shopping-cart service. Availability is measured as the number of successful requests divided by the number of total requests for the service",
"timeframe":"7d",
"target_threshold":99.9,
"monitor_ids":[
15173866,
15216083,
15254771
],
"creator":{
"name":"John Doe",
"handle":"john.doe@gmail.com",
"email":"john.doe@gmail.com"
},
"created_at":1707215619,
"modified_at":1707215619
}

Mapping Result

The combination of the sample payload and the Ocean configuration generates the following Port entity:

Monitor entity in Port
{
"identifier": "15173866",
"title": "A change @webhook-PORT",
"icon": null,
"blueprint": "datadogMonitor",
"team": [],
"properties": {
"tags": [
"app:webserver"
],
"overallState": "No Data",
"priority": "5",
"createdAt": "2024-01-31T13:32:21.270116+00:00",
"updatedAt": "2024-02-02T16:31:40.516062+00:00",
"createdBy": "john.doe@gmail.com",
"monitorType": "query alert"
},
"relations": {},
"createdAt": "2024-05-29T09:43:34.750Z",
"createdBy": "<port-client-id>",
"updatedAt": "2024-05-29T09:43:34.750Z",
"updatedBy": "<port-client-id>"
}
Service entity in Port
{
"identifier": "inventory-management",
"title": "inventory-management",
"icon": null,
"blueprint": "datadogService",
"team": [],
"properties": {
"owners": [
"inventory-team@example.com",
"warehouse-support@example.com"
],
"links": [
"https://github.com/example/inventory-service",
"https://wiki.example.com/runbooks/inventory-service"
],
"description": "Service for managing product inventory and stock levels.",
"tags": [
"inventory",
"stock"
],
"application": "Inventory System"
},
"relations": {},
"createdAt": "2024-05-29T10:31:44.283Z",
"createdBy": "<port-client-id>",
"updatedAt": "2024-05-29T10:31:44.283Z",
"updatedBy": "<port-client-id>"
}
SLO entity in Port
{
"identifier": "b6869ae6189d59baa421feb8b437fe9e",
"title": "Availability SLO for shopping-cart service",
"icon": null,
"blueprint": "datadogSlo",
"team": [],
"properties": {
"description": "This SLO tracks the availability of the shopping-cart service. Availability is measured as the number of successful requests divided by the number of total requests for the service",
"updatedAt": "2024-02-06T10:33:39Z",
"createdBy": "ahosea15@gmail.com",
"sloType": "monitor",
"targetThreshold": "99.9",
"tags": [
"service:shopping-cart",
"env:none"
],
"createdAt": "2024-02-06T10:33:39Z"
},
"relations": {
"monitors": [
"15173866",
"15216083",
"15254771"
],
"services": [
"shopping-cart"
]
},
"createdAt": "2024-05-29T09:43:51.946Z",
"createdBy": "<port-client-id>",
"updatedAt": "2024-05-29T12:02:01.559Z",
"updatedBy": "<port-client-id>"
}

Alternative installation via webhook

While the Ocean integration described above is the recommended installation method, you may prefer to use a webhook to ingest data from Datadog. If so, follow this guide.