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 responseCode int var _ = Describe("OpentsdbClient", func() { var ( ts *httptest.Server c *opentsdbclient.Client p opentsdbclient.Poster ) BeforeEach(func() { bodyChan = make(chan []byte, 1) responseCode = http.StatusOK ts = httptest.NewServer(http.HandlerFunc(handlePost)) p = poster.NewHTTPPoster(ts.URL) c = opentsdbclient.New(p, "opentsdb.nozzle.", "test-deployment", "test-job", "SOME-GUID", "dummy-ip") }) It("ignores messages that aren't value metrics or counter events", func() { c.AddMetric(&events.Envelope{ Origin: proto.String("origin"), Timestamp: proto.Int64(1000000000), EventType: events.Envelope_LogMessage.Enum(), Index: proto.String("SOME-METRIC-GUID"), LogMessage: &events.LogMessage{ Message: []byte("log message"), MessageType: events.LogMessage_OUT.Enum(), Timestamp: proto.Int64(1000000000), }, Deployment: proto.String("deployment-name"), Job: proto.String("doppler"),