func (o *OpenTSDBFirehoseNozzle) createClient() { ipAddress, err := localip.LocalIP() if err != nil { panic(err) } var transporter opentsdbclient.Poster if o.config.UseTelnetAPI { transporter = poster.NewTelnetPoster(o.config.OpenTSDBURL) } else { transporter = poster.NewHTTPPoster(o.config.OpenTSDBURL) } o.client = opentsdbclient.New(transporter, o.config.MetricPrefix, o.config.Deployment, o.config.Job, o.config.Index, ipAddress) }
var bodyChan chan []byte var responseCode int var _ = Describe("OpentsdbClient", func() { var ( ts *httptest.Server p *poster.HTTPPoster ) BeforeEach(func() { bodyChan = make(chan []byte, 1) responseCode = http.StatusOK ts = httptest.NewServer(http.HandlerFunc(handlePost)) p = poster.NewHTTPPoster(ts.URL) }) It("posts metrics in JSON format", func() { metric1 := poster.Metric{ Metric: "origin.metricName", Value: 5, Timestamp: 1, Tags: poster.Tags{ Deployment: "deployment-name", Job: "doppler", Index: "SOME-GUID", IP: "10.10.10.10", }, } metric2 := poster.Metric{