Datadog Plugin
note
*** DataDog costs can take up to 72 hours to appear in OpenCost ***
Setup Guide
- Obtain plugin binary
- Visit https://github.com/opencost/opencost-plugins/releases and choose the most recent release
- Download the correct binary for your architecture/OS
- Create a sibling directory to OpenCost called
plugins
- In plugins directory, create two sub directories:
bin
andconfig
- Put the plugin binary in the
bin
dir, ensure it is executable
- Create
datadog_config.json
in theconfig
dir, with the following contents:
{
"datadog_site": "us5.datadoghq.com",
"datadog_api_key": "<datadog_api_key>",
"datadog_app_key": "<datadog_app_key>"
}
- Ensure you set the following env vars:
PLUGIN_EXECUTABLE_DIR
Should have the full path to thebin
dir you set upPLUGIN_CONFIG_DIR
Should have the full path to theconfig
dirCUSTOM_COST_ENABLED
Set to“true”
- Also, set
LOG_LEVEL
to‘debug’
- Add in any other env vars you normally pass to OpenCost
- Start the app
- You should see a lot of debug output from the Datadog plugin
- After the ingestion completes, the info should be available in the repo objects, for both hourly and daily
Testing the Helm chart
- Support has been merged into the OpenCost Helm chart
- Update your local OpenCost Helm values file with the following settings:
loglevel: debug
plugins:
enabled: true
install:
enabled: true
fullImageName: curlimages/curl:latest
folder: /opt/opencost/plugin
# leave this commented to always download most recent version of plugins
#version: <INSERT_SPECIFIC_PLUGINS_VERSION>
# leave this commented to always download most recent version of plugins
# version: <INSERT_SPECIFIC_PLUGINS_VERSION>
# the list of enabled plugins
enabledPlugins:
- datadog
# pre-existing secret for plugin configuration
configSecret: ""
configs:
datadog: |
{
"datadog_site": "us5.datadoghq.com",
"datadog_api_key": "<datadog_api_key>",
"datadog_app_key": "<datadog_app_key>"
}
opencost:
exporter:
cloudProviderApiKey: "AIzaSyDXQPG_MHUEy9neR7stolq6l0ujXmjJlvk"
- Confirm that looking at the pod logs shows Datadog queries going through
Example UI
Below is an example of visualizations from the DataDog plugin in the OpenCost external costs UI: