R Client for 'Datadog' API

Query for metrics from 'Datadog' (< https://www.datadoghq.com/>) via its API.

Travis-CI Build Status AppVeyor Build Status CRAN_Status_Badge


datadogr is a simple package for querying data from Datadog.


datadogr is on CRAN now. You can install the released version from CRAN:


Or the the development version from GitHub:

# install.packages("devtools")



You must have an API key for Datadog to use APIs. Follow the instruction on the official document: http://docs.datadoghq.com/api/#authentication

datadogr package uses DATADOG_API_KEY environmental variable for the API key. You can set this by:

  • defining the environmental variables in .Renviron and restart R session.
  • inputting on the popup of k9_auth() interactively.

Get List of Metrics


Get Metrics Values

A query can be specified with query argument using a query string:

  query = "system.cpu.idle{role:db,environment:test}by{host,region}",
  from  = Sys.time() - 3600,
  to    = Sys.time()

Or, the same thing can be done with metric, scope and by separetely:

  metric = "system.cpu.idle",
  scope = list(role = "db", environment = "test"),
  by    = c("host", "region"),
  from  = Sys.time() - 3600,
  to    = Sys.time()

The result will look like this:

#> # A tibble: 2 x 8
#>             timestamp    value          metric    display_name query_index interval                     host
#> *              <dttm>    <dbl>           <chr>           <chr>       <int>    <int>                    <chr>
#> 1 2015-04-29 21:50:00 98.19376 system.cpu.idle system.cpu.idle           0      600 vagrant-ubuntu-trusty-64
#> 2 2015-04-29 22:00:00 99.85857 system.cpu.idle system.cpu.idle           0      600 vagrant-ubuntu-trusty-64
#> # ... with 3 more variables: environment <chr>, role <chr>, region <chr>, expression <chr>

Get Events

(This function is a but experimental.)

k9_get_events(start = Sys.Date() - 7, end = Sys.Date(), tags = list(role = "db"))


datadogr 0.1.1

  • Improve the calculation of the time period for metrics.
  • Automatically split the request when the period is longer than a day.
  • k9_events() is renamed to k9_get_events().

datadogr 0.1.0

  • Initial release.

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.


0.1.1 by Hiroaki Yutani, 7 months ago


Report a bug at https://github.com/yutannihilation/K9/issues

Browse source code at https://github.com/cran/datadogr

Authors: Hiroaki Yutani [aut, cre]

Documentation:   PDF Manual  

MIT + file LICENSE license

Imports anytime, dplyr, glue, httr, lubridate, purrr, stringr, tidyr, tibble

Suggests rstudioapi, testthat

See at CRAN