go-datadog-api
go-datadog-api copied to clipboard
Improve documentation for posting metrics
Here is my code to post metrics. Metrics explorer could not find the sent metrics. But there is no error shown
datadogClient := datadog.NewClient(config.API_KEY,config.APP_KEY)
data := []datadog.DataPoint{datadog.DataPoint{1.0,15.0}}
test:= datadog.Metric{}
test.Metric = "order"
test.Host = "golife"
test.Points = data
fmt.Println(test)
err = datadogClient.PostMetrics([]datadog.Metric{test})
if err != nil{
panic(err)
}
@ctoto93 the first value you pass into a datadog.DataPoint needs to be a UNIX timestamp which is documented here: https://github.com/zorkian/go-datadog-api/blob/master/series.go#L13-L15
Please try something like datadog.DataPoint{float64(time.Now().Unix()), 15.0} and let us know whether that works for you.
Follow up on this, I couldn't find any docs for the list of Types you can specify with a metric. Any idea?
@seiffert care to raise a PR with an example in the Readme?