go-datadog-api icon indicating copy to clipboard operation
go-datadog-api copied to clipboard

Help with PostMetrics

Open EArbeitman opened this issue 6 years ago • 1 comments

Hi,

Can you provide an example of how to init a DataPoint struct for PostMetrics call?

EArbeitman avatar Jul 03 '19 19:07 EArbeitman

So an example of this is dd.DataPoint{{dd.Float64(1.0), dd.Float64(2.0)}} from integration/series_test.go. The semantics of the two items in the inner slice is:

  • The first one is UNIX timestamp
  • The second one is the actual value of the metric at that time

Based on the above, the example would mean "Submit a metric with a single datapoint - time is 1970-01-01 00:00:01 (one second after midnight of first January 1970) and the value of the metric is 2.0.

This corresponds directly to what the endpoint accepts as documented in the API docs [1]. Is this unclear in the code? If so, what of the above information do you think would be useful to have in the docstring for the structure?

[1] https://docs.datadoghq.com/api/?lang=bash#post-timeseries-points

bkabrda avatar Feb 03 '20 13:02 bkabrda