Type: | Package |
Title: | R Client for 'Datadog' API |
Version: | 0.1.2 |
Description: | Query for metrics from 'Datadog' (https://www.datadoghq.com/) via its API. |
License: | MIT + file LICENSE |
URL: | https://yutannihilation.github.io/K9 |
BugReports: | https://github.com/yutannihilation/K9/issues |
Imports: | anytime, dplyr, glue, httr, lubridate, purrr, stringr, tidyr, tibble |
Suggests: | rstudioapi, testthat, jsonlite |
Encoding: | UTF-8 |
LazyData: | true |
RoxygenNote: | 6.0.1.9000 |
NeedsCompilation: | no |
Packaged: | 2018-05-17 11:35:51 UTC; hiroaki-yutani |
Author: | Hiroaki Yutani [aut, cre] |
Maintainer: | Hiroaki Yutani <yutani.ini@gmail.com> |
Repository: | CRAN |
Date/Publication: | 2018-05-17 16:42:07 UTC |
R Client for 'Datadog' API
Description
Query for metrics from 'Datadog' (https://www.datadoghq.com/) via its API.
Authentication for 'Datadog'
Description
Set API Key And Application Key
Usage
k9_auth()
Get Events
Description
This end point allows you to query for event details.
Usage
k9_get_events(event_id = NULL, start = NULL, end = NULL,
priority = NULL, sources = NULL, tags = NULL, .split_request = TRUE)
Arguments
event_id |
Event ID. |
start |
POSIX timestamp. |
end |
POSIX timestamp. |
priority |
Priority of events. |
sources |
Sources of events. A |
tags |
Tags of events. A named |
.split_request |
if |
See Also
http://docs.datadoghq.com/api/?lang=console#events
Examples
## Not run:
# by default get all events happend from an hour ago
k9_get_events()
# get all events happend in this week
k9_get_events(start = Sys.Date() - 7, end = Sys.Date())
# specify an event by ID
k9_get_events(event_id = "112233445566")
# specify tag
k9_get_events(tags = list(role = "db"))
## End(Not run)
Query Time Series Points
Description
This end point allows you to query for metrics from any time period.
Usage
k9_get_metrics(query = NULL, metric = NULL, scope = NULL, by = NULL,
from = NULL, to = NULL, .split_request = TRUE)
Arguments
query |
query string |
metric |
metric name |
scope |
list of scopes ( |
by |
key to group aggregation |
from |
seconds since the unix epoch |
to |
seconds since the unix epoch |
.split_request |
if |
Details
You can query either query
, or the combination of metric
, scope
and by
.
For example, on the one hand you can directly query by using
query = "system.cpu.idle{role:db,environment:test}by{host,region}"
.
On the other hand, you can specify metric = "system.cpu.idle"
,
scope = list(role = "db", environment = "test")
and by = c("host", "region"),
to build the same query.
Note that, if query
is given, the latter will be ignored.
from
and by
can be one of these:
-
numeric
-
POSIXct
-
POSIXlt
-
Date
-
character
(parsed byanytime::anytime()
) -
NULL
(the current epochtime will be used instead)
See Also
http://docs.datadoghq.com/api/?lang=console#metrics http://docs.datadoghq.com/graphing/
Get List Of Active Metrics
Description
Get the list of actively reporting metrics from a given time until now.
Usage
k9_list_metrics(from = NULL)
Arguments
from |
seconds since the unix epoch |
Examples
## Not run:
# by default, list all metrics available since 1 hour ago
k9_list_metrics()
# if from argument is provided, this tries to get active metrics from the time
k9_list_metrics(Sys.Date() - 1)
## End(Not run)
Posts a metric value to Datadog
Description
This end point allows you to post time-series data that can be graphed on Datadog’s dashboards or queried from any time period.
Usage
k9_post_metric(metric, metric_type, value, tags = list(), interval = NULL)
Arguments
metric |
the name of the time series |
metric_type |
type of your metric either: gauge, rate, or count. Optional, default=gauge |
value |
the numeric value to post |
tags |
a list of tags associated with the metric. |
interval |
if the type of the metric is rate or count, define the corresponding interval. Optional, default=None |
Details
The Datadog API uses resource-oriented URLs, uses status codes to indicate the success or failure of requests and returns JSON from all requests. With this method you can post counters, gauges to measure the value of a particular thing over time and rates that represent the derivative of a metric, it’s the value variation of a metric on a defined time interval.
See Also
http://docs.datadoghq.com/api/?lang=console#metrics http://docs.datadoghq.com/graphing/ https://docs.datadoghq.com/developers/metrics/#metric-types