zorkian / go-datadog-api

A Go implementation of the Datadog API.
BSD 3-Clause "New" or "Revised" License
183 stars 156 forks source link

Help with PostMetrics #249

Open EArbeitman opened 5 years ago

EArbeitman commented 5 years ago

Hi,

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

bkabrda commented 4 years ago

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:

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