diff --git a/examples/basic_example.go b/examples/basic_example.go index 2511163..8a6d218 100644 --- a/examples/basic_example.go +++ b/examples/basic_example.go @@ -17,23 +17,19 @@ func main() { librato.Mail = "mail@domain.com" librato.Token = "abcd1234abcd1234abcd1234abcd1234abcd1234abcd1234abcd1234abcd1234" - // We use prefix "example:" which will be added to each gauge and counter sended - // to Librato - librato.Prefix = "example:" - for { errs := librato.AddMetric( librato.Gauge{ - Name: "gauge_1", + Name: "example:gauge_1", Value: rand.Int(1000), }, librato.Gauge{ - Name: "gauge_2", - Value: float64(rand.Int(1000)) / float64(rand.Int(20)), + Name: "example:gauge_2", + Value: float64(rand.Int(1000)) / 5.0, Source: "go_librato_example", }, librato.Counter{ - Name: "counter_1", + Name: "example:counter_1", Value: rand.Int(1000), }, ) diff --git a/librato.go b/librato.go index 1cb41b0..728661f 100644 --- a/librato.go +++ b/librato.go @@ -23,7 +23,7 @@ import ( // ////////////////////////////////////////////////////////////////////////////////// // // VERSION contains current version of librato package and used as part of User-Agent -const VERSION = "2.0.2" +const VERSION = "2.0.3" // ////////////////////////////////////////////////////////////////////////////////// // @@ -311,8 +311,6 @@ func AddMetric(m ...Measurement) []error { } } - appendGlobalPrefix(data) - return execRequest(req.POST, APIEndpoint+"/v1/metrics/", data) } @@ -393,8 +391,6 @@ func (mt *Metrics) Send() []error { mt.queue = make([]Measurement, 0) - appendGlobalPrefix(data) - errs := execRequest(req.POST, APIEndpoint+"/v1/metrics/", data) mt.execErrorHandler(errs) @@ -535,21 +531,6 @@ func convertMeasurementSlice(queue []Measurement) measurements { return result } -// appendGlobalPrefix append global prefix to each measurement -func appendGlobalPrefix(data measurements) { - if Prefix == "" { - return - } - - for _, c := range data.Counters { - c.Name = Prefix + c.Name - } - - for _, g := range data.Gauges { - g.Name = Prefix + g.Name - } -} - // execRequest create and execute request to API func execRequest(method, url string, data interface{}) []error { request := req.Request{