From dbb75a1bc1186211e1fe69c403a56ae293849e20 Mon Sep 17 00:00:00 2001 From: brettlangdon Date: Fri, 18 Mar 2016 17:01:39 -0400 Subject: [PATCH] update docs --- index.html | 201 ++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 137 insertions(+), 64 deletions(-) diff --git a/index.html b/index.html index ff619f0..c863c38 100644 --- a/index.html +++ b/index.html @@ -20,6 +20,8 @@ document.addEventListener("DOMContentLoaded", function(){hljs.initHighlightingOn
  • downtime
  • +
  • embed +
  • event
  • graph @@ -317,6 +319,138 @@ dogapi.downtime.getAll(function(err, res){ +
    +
    +

    embed

    + +
    +

    create(graph_json, options, options["timeframe"], options["size"], options["legend"], options["title"], callback)

    +
    +

    create an embed graph of a metric query

    +

    Parameters:

    +
    +
    graph_json
    +

    The request array to pass create in the embed

    +
    +
    options
    +

    optional, object of extra parameters to pass to the embed create (see options[*] params)

    +
    +
    options["timeframe"]
    +

    optional, one of ("1_hour", "4_hours", "1_day", "2_days", and "1_week")

    +
    +
    options["size"]
    +

    optional, one of ("small", "medium", "large", "xlarge")

    +
    +
    options["legend"]
    +

    optional, "yes" or "no"

    +
    +
    options["title"]
    +

    optional, the title of the embed

    +
    +
    callback
    +

    function(err, res)

    +
    +
    +
    +
    +
    var dogapi = require("dogapi");
    +var options = {
    +  api_key: "api_key",
    +  app_key: "app_key"
    +};
    +dogapi.initialize(options);
    +var query = "system.cpu.idle{*}";
    +var graphJSON = {
    +       viz: "timeseries",
    +       requests: [
    +         {
    +           q: query,
    +           aggregator: "avg",
    +           conditional_formats: [],
    +           type: "area"
    +         }
    +       ]
    +     }
    +var options = {
    +    timeframe: "1_hour",
    +    size: "xlarge",
    +    legend: "yes",
    +    title: "my awesome embed"
    +};
    +dogapi.embed.create(graphJSON, options, function(err, res){
    +  console.dir(res);
    +});
    +
    +
    +
    +
    +

    revoke(embedId, callback)

    +
    +

    delete an embed with a specific id

    +

    Parameters:

    +
    +
    embedId
    +

    the id of the embed to delete

    +
    +
    callback
    +

    function(err, res)

    +
    +
    +
    +
    +
    var embedid = "foo";
    +dogapi.embed.revoke(embedid, function(err, res){
    +  console.dir(res);
    +});
    +
    +
    +
    +
    +

    getAll(callback)

    +
    +

    get all embeds from datadog

    +

    Parameters:

    +
    +
    callback
    +

    function(err, res)

    +
    +
    +
    +
    +
    dogapi.embed.getAll(function(err, res){
    +  console.dir(res);
    +});
    +
    +
    +
    +
    +

    get(embedId, callback)

    +
    +

    get a single embed

    +

    Parameters:

    +
    +
    embedId
    +

    the id of the embed to get

    +
    +
    callback
    +

    function(err, res)

    +
    +
    +
    +
    +
    var embedId = "foo";
    +dogapi.embed.get(embedId, function(err, res){
    +  console.dir(res);
    +});
    +
    +
    +
    +

    event

    @@ -455,7 +589,6 @@ dogapi.downtime.getAll(function(err, res){

    graph

    snapshot(query, from, to, eventQuery, callback)

    @@ -496,66 +629,6 @@ dogapi.graph.snapshot(query, from, to, function(err, res){
    -
    -

    createEmbed(graph_json, options, options["timeframe"], options["size"], options["legend"], options["title"], callback)

    -
    -

    create an embed graph of a metric query

    -

    Parameters:

    -
    -
    graph_json
    -

    The request array to pass create in the embed

    -
    -
    options
    -

    optional, object of extra parameters to pass to the embed create (see options[*] params)

    -
    -
    options["timeframe"]
    -

    optional, one of ("1_hour", "4_hours", "1_day", "2_days", and "1_week")

    -
    -
    options["size"]
    -

    optional, one of ("small", "medium", "large", "xlarge")

    -
    -
    options["legend"]
    -

    optional, "yes" or "no"

    -
    -
    options["title"]
    -

    optional, the title of the embed

    -
    -
    callback
    -

    function(err, res)

    -
    -
    -
    -
    -
    var dogapi = require("dogapi");
    -var options = {
    -  api_key: "api_key",
    -  app_key: "app_key"
    -};
    -dogapi.initialize(options);
    -var query = "system.cpu.idle{*}";
    -var graphJSON = {
    -       viz: "timeseries",
    -       requests: [
    -         {
    -           q: query,
    -           aggregator: "avg",
    -           conditional_formats: [],
    -           type: "area"
    -         }
    -       ]
    -     }
    -var options = {
    -    timeframe: "1_hour",
    -    size: "xlarge",
    -    legend: "yes",
    -    title: "my awesome embed"
    -};
    -dogapi.graph.createEmbed(graphJSON, options, function(err, res){
    -  console.dir(res);
    -});
    -
    -
    -
    @@ -687,7 +760,7 @@ or an array of [timestamp, value] elements (e.g. [[now, 50],
    • host: the host source of the metric
    • tags: array of "tag:value"'s to use for the metric
    • -
    • metric_type|type: which metric type to use ("gauge" or "counter") [default: gauge]
    • +
    • metric_type|type: which metric type to use ("gauge" or "count") [default: gauge]
    callback
    @@ -712,7 +785,7 @@ var now = parseInt(new Date().getTime() / 1000); dogapi.metric.send("my.metric", [[now, 1000]], function(err, results){ console.dir(results); }); -dogapi.metric.send("my.counter", 5, {type: "counter"}, function(err, results){ +dogapi.metric.send("my.counter", 5, {type: "count"}, function(err, results){ console.dir(results); });
    @@ -731,7 +804,7 @@ dogapi.metric.send("my.counter", 5, {type: "counter"}, funct
  • points: a single data point (e.g. 50), an array of data points (e.g. [50, 100]) or an array of [timestamp, value] elements (e.g. [[now, 50], [now, 100]])
  • tags: an array of "tag:value"'s
  • host: the source hostname to use for the metrics
  • -
  • metric_type|type: the type of metric to use ("gauge" or "counter") [default: gauge]
  • +
  • metric_type|type: the type of metric to use ("gauge" or "count") [default: gauge]
  • callback