DataDog and Travis CI

TCI-Graphics for AdsBlogs (4)

In this weekly edition of my blog posts, I’m going to show you how to effcitevely pull HCL files (Terraform, Vault, Vagrant) and more using Travis CI and DataDog. Take a seat, this is going to be a short blog today, but a goodie.

Getting started

Let’s get and set your environment variables from DataDog:

export DATADOG_API_KEY=foo
export DATADOG_APP_KEY=bar

Screen Shot 2022-01-07 at 11 08 02 AM

Get your credentials within DataDog, then port them over to Travis CI. Since this is a Go project I’ve selected, this is how our .travis.yml is going to look like:

language: go
  - 1.13.x

install: true

  - script/test
  - go build

  email: false
  slack: false

  - master
  - v2.0

You can in theory remove -v2.0 from the branches, make sure you have all the proper HCL programs specified. You can run:

datadog-fetch-hcl -id <dashboard id> -title <resource title>


Here are some metrics DataDog will grab: (gauge) Duration of builds Shown as second (count) Count of finished builds Shown as build (count) Count of jobs Shown as job
travis_ci.job.duration (gauge) Duration of jobs Shown as second
travis_ci.job.finished (count) Count of finished jobs Shown as job
travis_ci.job.queued_time (gauge) Time jobs spent waiting in queue before starting Shown as second

What is DataDog exactly counting?

Basically the duration of the build, amongst other nuance detailes, and if there’s any 3rd party factors causing a slowdown if there is one. Make sure you’re sill logged into DataDog:

Screen Shot 2022-01-07 at 11 13 42 AM

Now let’s trigger a build in Travis CI:

Screen Shot 2022-01-07 at 11 47 00 AM

As you can tell, we’ve had a successful build with DataDog and Travis CI!


There you go, DataDog see’s no vulns, and you were able to fetch your HCL programs you wanted. In this case Terraform was important to me, but other applications will be more important to other people at different times.

There you have it! You’ve just used DataDog with Travis CI, again I’m glad to be showing the flexibility and ease of use with Travis CI.

As always if you have any questions, any questions at all, please email me at

Happy building!