Ran go fmt on opentsdb sources.

This commit is contained in:
Eric 2016-07-22 08:29:55 -04:00
parent 71c53841c3
commit 8ab9cc29af
3 changed files with 104 additions and 105 deletions

View File

@ -47,6 +47,7 @@ var sampleConfig = `
## Debug true - Prints OpenTSDB communication ## Debug true - Prints OpenTSDB communication
debug = false debug = false
` `
type TagSet map[string]string type TagSet map[string]string
func (t TagSet) ToLineFormat() string { func (t TagSet) ToLineFormat() string {

View File

@ -1,16 +1,16 @@
package opentsdb package opentsdb
import ( import (
"fmt" "bytes"
"compress/gzip"
"encoding/json" "encoding/json"
"fmt"
"io" "io"
"io/ioutil" "io/ioutil"
"log"
"net/http" "net/http"
"net/http/httputil" "net/http/httputil"
"net/url" "net/url"
"bytes"
"compress/gzip"
"log"
) )
type HttpMetric struct { type HttpMetric struct {
@ -20,7 +20,6 @@ type HttpMetric struct {
Tags map[string]string `json:"tags"` Tags map[string]string `json:"tags"`
} }
type openTSDBHttp struct { type openTSDBHttp struct {
Host string Host string
Port int Port int
@ -124,7 +123,7 @@ func (o *openTSDBHttp) flush() error {
Path: "/api/put", Path: "/api/put",
} }
if (o.Debug) { if o.Debug {
u.RawQuery = "details" u.RawQuery = "details"
} }
@ -135,7 +134,7 @@ func (o *openTSDBHttp) flush() error {
req.Header.Set("Content-Type", "applicaton/json") req.Header.Set("Content-Type", "applicaton/json")
req.Header.Set("Content-Encoding", "gzip") req.Header.Set("Content-Encoding", "gzip")
if (o.Debug) { if o.Debug {
dump, err := httputil.DumpRequestOut(req, false) dump, err := httputil.DumpRequestOut(req, false)
if err != nil { if err != nil {
return fmt.Errorf("Error when dumping request: %s", err.Error()) return fmt.Errorf("Error when dumping request: %s", err.Error())

View File

@ -1,14 +1,14 @@
package opentsdb package opentsdb
import ( import (
"reflect"
"testing"
"fmt" "fmt"
"net" "net"
"net/http" "net/http"
"net/http/httptest" "net/http/httptest"
"net/url" "net/url"
"reflect"
"strconv" "strconv"
"testing"
"github.com/influxdata/telegraf" "github.com/influxdata/telegraf"
"github.com/influxdata/telegraf/testutil" "github.com/influxdata/telegraf/testutil"
@ -83,7 +83,6 @@ func BenchmarkHttpSend(b *testing.B) {
metrics[i] = testutil.TestMetric(1.0) metrics[i] = testutil.TestMetric(1.0)
} }
ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "application/json") w.Header().Set("Content-Type", "application/json")
fmt.Fprintln(w, "{}") fmt.Fprintln(w, "{}")