Documentation ¶
Overview ¶
Example (DatadogTracker) ¶
package main import ( "fmt" "log" "net/http" "time" "github.com/bukalapak/ottoman/tracker/datadog" ) func main() { tc := datadog.New("service_name", "this api key is secret", datadog.Option{ Transport: http.DefaultTransport, Timeout: time.Second * 1, }) payload := datadog.Series{ Series: []datadog.Metric{ { Metric: "service_name.command.call", Type: datadog.Count, Points: [][2]int64{{time.Now().Unix(), 1}}, Tags: []string{ "environment:production", "version:1", "sub_command:mock", }, }, }, } resp, err := tc.Track(payload) if err != nil { log.Println(err) } fmt.Println(resp) }
Output:
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Datadog ¶
type Datadog struct { ServiceName string // contains filtered or unexported fields }
Datadog is a client for request to datadog's endpoint
type Metric ¶
type Metric struct { Metric string `json:"metric,omitempty" validate:"required"` Points [][2]int64 `json:"points,omitempty" validate:"required"` Type Type `json:"type,omitempty"` Interval int64 `json:"interval,omitempty"` Host string `json:"host,omitempty"` Tags []string `json:"tags,omitempty"` }
DatadogMetric represent single metric of series
type Option ¶
type Option struct { Transport http.RoundTripper Timeout time.Duration }
Option is the configuration option for the Datadog tracker.
type Series ¶
type Series struct {
Series []Metric `json:"series"`
}
Series represent time-series data that can be graphed on Datadog’s dashboards Further information can be accessed on https://docs.datadoghq.com/api/?lang=bash#post-timeseries-points
Click to show internal directories.
Click to hide internal directories.