datadog/datadog.go
func (c *Client) Post(metrics []Metric) error {
	series := struct {
		Series []Metric `json:"series,omitempty"`
	}{Series: metrics}

	buf := fetchBuffer()
	defer bufferPool.Put(buf)

	var dst io.Writer = buf
	if !c.DisableCompression {
		zlw := fetcZlibWriter(buf)
		defer zlibWriterPool.Put(zlw)
		defer zlw.Close()

		dst = zlw
	}

	if err := json.NewEncoder(dst).Encode(&series); err != nil {
		return err
	}
	if c, ok := dst.(io.Closer); ok {
		if err := c.Close(); err != nil {
			return err
		}
	}
	return c.post(buf.Bytes(), 0)
}
func (c *Client) Post(metrics []Metric) error {
	series := struct {
		Series []Metric `json:"series,omitempty"`
	}{Series: metrics}

	buf := fetchBuffer()
	defer bufferPool.Put(buf)

	var dst io.Writer = buf
	if !c.DisableCompression {
		zlw := fetcZlibWriter(buf)
		defer zlibWriterPool.Put(zlw)
		defer zlw.Close()

		dst = zlw
	}

	if err := json.NewEncoder(dst).Encode(&series); err != nil {
		return err
	}
	if c, ok := dst.(io.Closer); ok {
		if err := c.Close(); err != nil {
			return err
		}
	}
	return c.post(buf.Bytes(), 0)
}
func ( c * Client ) Post ( metrics [ ] Metric ) error { series := struct { Series [ ] Metric `json:"series,omitempty"` } { Series : metrics } buf := fetchBuffer ( ) defer bufferPool . Put ( buf ) var dst io . Writer = buf if ! c . DisableCompression { zlw := fetcZlibWriter ( buf ) defer zlibWriterPool . Put ( zlw ) defer zlw . Close ( ) dst = zlw } if err := json . NewEncoder ( dst ) . Encode ( & series ) ; err != nil { return err } if c , ok := dst . ( io . Closer ) ; ok { if err := c . Close ( ) ; err != nil { return err } } return c . post ( buf . Bytes ( ) , 0 ) }
// Post delivers a metrics snapshot to datadog
Post delivers a metrics snapshot to datadog